• + 1 comment

    great approach. i don't understand the logic but still approach is outstanding in terms of complexity.

    • + 0 comments

      Hi. Here's a detailed explanation of the logic that I wrote. My solution uses the same concept as above. Hope this helps.

      HackerRank solutions.