2119. A Number After a Double Reversal Easy
1/**
2 * [2119] A Number After a Double Reversal
3 *
4 * Reversing an integer means to reverse all its digits.
5 *
6 * For example, reversing 2021 gives 1202. Reversing 12300 gives 321 as the leading zeros are not retained.
7 *
8 * Given an integer num, reverse num to get reversed1, then reverse reversed1 to get reversed2. Return true if reversed2 equals num. Otherwise return false.
9 *
10 * Example 1:
11 *
12 * Input: num = 526
13 * Output: true
14 * Explanation: Reverse num to get 625, then reverse 625 to get 526, which equals num.
15 *
16 * Example 2:
17 *
18 * Input: num = 1800
19 * Output: false
20 * Explanation: Reverse num to get 81, then reverse 81 to get 18, which does not equal num.
21 *
22 * Example 3:
23 *
24 * Input: num = 0
25 * Output: true
26 * Explanation: Reverse num to get 0, then reverse 0 to get 0, which equals num.
27 *
28 *
29 * Constraints:
30 *
31 * 0 <= num <= 10^6
32 *
33 */
34pub struct Solution {}
35
36// problem: https://leetcode.com/problems/a-number-after-a-double-reversal/
37// discuss: https://leetcode.com/problems/a-number-after-a-double-reversal/discuss/?currentPage=1&orderBy=most_votes&query=
38
39// submission codes start here
40
41impl Solution {
42 pub fn is_same_after_reversals(num: i32) -> bool {
43 false
44 }
45}
46
47// submission codes end
48
49#[cfg(test)]
50mod tests {
51 use super::*;
52
53 #[test]
54 fn test_2119() {
55 }
56}
57
Back
© 2025 bowen.ge All Rights Reserved.