Ad
Code
Diff
  • fn vector_multiply(input: Vec<i32>) -> i32 {
        input.iter()
            .product()
    }
    • fn vector_multiply(input: Vec<i32>) -> i32 {
    • let mut out = 1;
    • for i in input {
    • out *= i;
    • }
    • out
    • input.iter()
    • .product()
    • }
Code
Diff
  • fn solution(mut x: i32) -> bool {
        x.to_string()
            .contains('3')
    }
    • fn solution(mut x: i32) -> bool {
    • match x.to_string().chars().into_iter().position(|s| s == '3') {
    • Some(_t) => true,
    • _e => false,
    • }
    • x.to_string()
    • .contains('3')
    • }
Code
Diff
  • def is_anagram(s1, s2):
        return sorted(s1) == sorted(s2)
        
      
    • def is_anagram(s1, s2):
    • s1 = {k:k.count(k) for k in s1}
    • s2 = {k:k.count(k) for k in s2}
    • return s1 == s2
    • return sorted(s1) == sorted(s2)