Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

Interview Question

Interview(Student Candidate)

Given an array of distinct integers, and a target integer

  t, compute all of the subsets of the array that sum to t, where order matters. (I was given ~20 minutes to solve this)

Interview Answer

2 Answers


Simple - use divide et impera to create the list for number N as (1, Listfor(N-1)), (2, listfor(N-2)) ... etc

Alex on Feb 7, 2013


Python answer on Feb 17, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.