currently I am having a linked list (named as "input") containing 1Million of integers in it ( let's assume data from 1 to 1000000) All the numbers are sorted in ascending/increasing order. list can have duplicate numbers in it.
I have k=369742
now i need to find the set whose sum is exactly same as k or nearest upper value to k.
what will be the best approach to solve above. I have designed with backtracking, but time complexity in worst case is more.
can anyone suggest best approach.
Comments
Post a Comment