⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 11s17 days 22 hours 20 minutes 11 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 11s17 days 22 hours 20 minutes 11 seconds.

Sign in to watch this lesson
Algorithms - Recursion, Backtracking and Combinatorics · 4:22
Three ways to list every subset: counting bitmasks from 0 to 2^n - 1 like an odometer, the take-or-leave recursion, and the Gray code i ^ (i >> 1), where one item changes per step so a running total updates in constant time (prices 2, 5 and 7 hit a target of 7 twice; on 24 items the Gray walk was dozens of times faster than recomputing every sum). Then std::next_permutation in three moves (pivot, swap, reverse the tail), why aabc gives 12 arrangements and not 24, why you must sort first, and a measured table of how far listing goes.