Practice · 5 of 5
Two-branch subset sum
CHALLENGE
Difficulty: intermediate+25 XP
Implement boolean subset(int[] arr, int i, int target): can some subset of arr[i..] sum to target? Two branches at each element (take it / skip it); base cases: target == 0 → true, i exhausted → target == 0. Trace {2, 5, 3}, target 8 by hand.
Press Submit to check your solution.
Back to lesson: Practice: Recursion lab