java.lang.Object
g2101_2200.s2119_a_number_after_a_double_reversal.Solution

public class Solution extends Object
2119 - A Number After a Double Reversal.<p>Easy</p> <p><strong>Reversing</strong> an integer means to reverse all its digits.</p> <ul> <li>For example, reversing <code>2021</code> gives <code>1202</code>. Reversing <code>12300</code> gives <code>321</code> as the <strong>leading zeros are not retained</strong>.</li> </ul> <p>Given an integer <code>num</code>, <strong>reverse</strong> <code>num</code> to get <code>reversed1</code>, <strong>then reverse</strong> <code>reversed1</code> to get <code>reversed2</code>. Return <code>true</code> <em>if</em> <code>reversed2</code> <em>equals</em> <code>num</code>. Otherwise return <code>false</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> num = 526</p> <p><strong>Output:</strong> true</p> <p><strong>Explanation:</strong> Reverse num to get 625, then reverse 625 to get 526, which equals num.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> num = 1800</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> Reverse num to get 81, then reverse 81 to get 18, which does not equal num.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> num = 0</p> <p><strong>Output:</strong> true</p> <p><strong>Explanation:</strong> Reverse num to get 0, then reverse 0 to get 0, which equals num.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>0 <= num <= 10<sup>6</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • isSameAfterReversals

      public boolean isSameAfterReversals(int num)