solulubeta
Sign in
Recursion & Memo / Choices and backtracking
02.03 · Problem

Subsets

Easy Pick or skip LC 78 Pro

Given distinct numbers, return every subset, including the empty one and the full one. Any order is fine.

Examples

Example 1

Input:  nums = [1, 2, 3]
Output: [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]

Example 2

Input:  nums = [0]
Output: [[], [0]]
solulu Pro

Continue this problem with Pro

Inside: step-by-step hints · 8 hidden tests · reference solutions · code editor.

Lifetime ₹1,999 ₹999 · Launch offer
Mark this problem as solved when you are finished.

Item 14 of 44 · updated 2026-10-13