Comments (1)

Followers (1)

Reputation 10

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

This solution works for a sorted array with positive numbers and positive target sum

1. For each number, either include that number or exclude it.

2. If you include the number, recursively call the function for the remaining array, target sum being original_target_sum - current_number

3. If you exclude the number, recursively call the function for the remaining array, target sum being original_target_sum

4. If at any point the target_sum is the same as the current number, that means the sum for that branch of the recusrive tree is equal to the target sum. Print the numbers in that branch.

5. If the target_sum is less than the current number, then there is no point in going forward with that branch, as the sum will always be greater than the target sum.

6. Return if current is equal to length, meaning we've reached the end of the target array.

- soumyashukla22 October 04, 2017