Ad
  • Custom User Avatar

    Nice glad you enjoyed it. The top solution on the solutins page has a nice explanation.

  • Custom User Avatar

    Have a read below if you are stuck 👍

  • Custom User Avatar

    That is because there is a more efficient way to solve this problem than your code. It's not about number of lines, it's about how many times you iterate through the input. You should not use any for loops.
    And in future this is a question not an issue because it is a problem with your code.