@Sunny.. why do we need an O(2^N) complexity? for a value of N=40-50, the solution is not useful..
but, your 1st approach is lot better and i have got it too.. 1. O(N) complexity to search the k. (k bits in the numbers) x- (sigma 1->k (n C i)) 2. again, keep substracting (k-i) for i= 0->k-1 so.. O(k) here and recursively performing step 2. (worst case complexity is O(T)) where T = nCk O(N) + O(T) ==> O(T) as it dominates the given number. unless it doesn't fall in the range.. or equivalently --> max( O(T), O(N) ) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/NJR9l-UB7c8J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.