Combination Sum

Medium · Backtracking · about 20 minutes

Asked at Airbnb, Amazon, Uber, Meta, Booking.com, Expedia Group.

Given an array of distinct positive integers candidates and a target, return all unique combinations of candidates that sum to target. The same number may be chosen any number of times. List each combination in non-decreasing order; the combinations may be in any order.

Related guides