Ad
  • Custom User Avatar

    Lang: Rust

    So I have noticed after passing the first tests that my println!() prints multiple times in one comp() call.

    E.g.:

    fn comp(a: Vec<i64>, b: Vec<i64>) -> bool {
      //prints "a" vector 3 times for some reason
      println!("{}", a);
      
      //... code that makes first tests work
    };
    

    which is weird. I am pretty sure my solution should work for any given input. Any ideas on why the Vector is printed multiple times? I obviously dont have it in a loop.

  • Custom User Avatar

    Yeah! That kinda structures are very usefull.

  • Custom User Avatar

    Hi! That's part of the learning experience. You can see some tests that your algorithm has to pass. Some tests are hidden. Your code has to work for any given input, you can't simply test every single possible input so you have got to refactor your code so that it works for every possible input.

  • Custom User Avatar

    Thanks for tip

  • Custom User Avatar

    Well yea, no need to say thank you.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It is a fun kata but easier than some 4kyu ones.

  • Custom User Avatar

    I tried a lot of different solutions until I made my wonky solution work. I feel so bad after seeing the solutions. Should learn what a stack is I guess.