Ad
  • Custom User Avatar

    Yep, this is O(n²) for the reason you explained.
    And I disagree with RazNaot, just because you can solve a problem inefficiently doesn't mean you should. The goal of this website is to improve at programming.

  • Custom User Avatar

    The custom in this site for the easier katas, is not to be restricted by performance and memory constraints. At most katas leveled kyu 8 to kyu 6, almost all algorithms will work. They are meant to be easy training, with fewer and smaller test cases - so just do something that works and you'll pass. The harder katas - around kyu 5,4 and up may require "performance" - i.e. slower algos may fail etc. Browse "Kata" on the top left menu to get to harder questions...