aks
BAN USER
Comments (3)
Reputation 0
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Open Chat in New Window
Open Chat in New Window
I dont think it is possible to find a solution in O(n). If it was a pair then yes using a HashMap would help. But if it is more than 2 numbers adding to the sum, its a DP problem and cannot be solved using O(n)
- aks April 05, 2016