Ad
Code
Diff
  • fn solution(mut x: i32) -> bool {
        match x.to_string().chars().into_iter().position(|s| s == '3') {
            Some(_t) => true,
            _e => false,
        }
    }
    • fn solution(mut x: i32) -> bool {
    • for d in x.to_string().chars() {
    • if d == '3' {
    • return true;
    • }
    • match x.to_string().chars().into_iter().position(|s| s == '3') {
    • Some(_t) => true,
    • _e => false,
    • }
    • false
    • }
Code
Diff
  • fn solution(mut x: i32) -> bool {
        for d in x.to_string().chars() {
            if d == '3' {
                return true;
            }
        }
        false
    }
    • fn solution(mut x: i32) -> bool {
    • x = x.abs();
    • while x > 0 {
    • if x % 10 == 3 {
    • for d in x.to_string().chars() {
    • if d == '3' {
    • return true;
    • }
    • x /= 10;
    • }
    • false
    • }