summaryrefslogtreecommitdiff
path: root/reverse-integer/src/main.rs
blob: acb54a61b013d0d22ba32a1b4537ca99680fa011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn main() {
    println!("Hello, world!");
}


struct Solution;

impl Solution {
    pub fn reverse(x: i32) -> i32 {
        x.abs().to_string().chars().rev().collect::<String>().parse::<i32>().unwrap_or(0) * x.signum()
    }
}