Skip to main content
Medium Backtracking Medium frequency

Combination Sum II

Open on LeetCode

Approach Summary

Sort candidates, then backtrack with a start index. Skip duplicates at the same recursion level so each element is used once.

How to Recognize This Pattern

  • Duplicates in candidates — skip same value at same level
  • Difference from Combination Sum: each number used once

Complexity Analysis

Time Complexity

O(2ⁿ)

Space Complexity

O(n)

Tags

Array Backtracking

This site is free. If these guides are helping your prep, consider buying me a coffee. ☕

Support →
Buy me a coffee