this one , i can do it in O(n^2) , i m able to do it in O(n sqrt(max)) , but has anyone got a better idea such as O(n) or O(logn) or something like that.

1 Like

How can you get Time Complexity of O(logN) if number of integers in array itself is N. -_-

2 Likes

That problems 95% same as hackerrankâ€™s week of code contest going right now, isnt it?

yeah vijju almost same