Stop at the page.
transcript
Forty items make a huge list. You need only one page. Do not build the rest.
Forty items have more than a trillion subsets. A page at position one hundred thousand needs 200,265 calls. The counter measured it.
Count each answer as it is found. Save only those on the page. Stop the moment the page is full.
The recursion lists the subsets in order. The first answers are skipped. The page fills up next. Then the whole tree stops.
Check the page at the top of each call. Return at once when it is full. That skips every later call.
The page needed about two hundred thousand calls. That is not a trillion. The saving is enormous.
Keep one counter of answers seen. Add one for each finished subset. Compare it with the start of the page.
Build only the page you need. The tree does the rest. Full breakdown in the lecture.