Unique Number 3- Run error in test case 3

You are not performing bound checking on ‘cnt[]’. As cnt can have valid indices (required to calculate the ‘ans’) from 0 to 63 but you are trying to run ‘for()’ loop from 0 to n. That’s why your code is giving run error in one of the test cases on Hacker blocks.

1 Like