Ad
  • Default User Avatar

    Very cool! Unless I am missing something, this solution runs in constant time O(1) as the common solution (even I wrote it with a loop) using a loop is linear O(n) time. Please, someone correct me if I am wrong.

  • Default User Avatar

    It's a bug in the test cases that still isn't fixed.

    EDIT: NOT A BUG. I MISREAD THE INSTRUCTIONS.

  • Default User Avatar

    Getting the false negative failing test case. I debugged and believe the number passed in is 159 which sums to 15. But test case is expecting 6.

    EDIT: In Python
    EDIT2: NOT A BUG. I MISREAD THE INSTRUCTIONS.