3 ms·
Not sure what you'd need the loads of memory for? int[] nums = {...} for i = 1 to (2^length(nums) - 1) int[] possibility = { nums[x] where (2^x
by tbrownaw 16y ago
Not sure what you'd need the loads of memory for?
int[] nums = {...}
for i = 1 to (2^length(nums) - 1)
int[] possibility = { nums[x] where (2^x bitand i) > 0 }
test possibility and perhaps increment hit counter
- zmitri 16y agoI was at work on a crappy thin client and first tried to run list(itertools.combinations(sequence)), which was crapping out. After I switched it to itertools.combinations(sequence,i) and put that right into my for loop it was fine.