1.
This solution uses a break
statement at the end of for(int i=0; i<n; i++)
loop (just after mask -= (1<<i)
).
How to "prove" that this break
still allows all cases to be tested?
What are some other problems that have this?
2.
What is the time complexity (closed form?)?
My take:
If $$$T(k)$$$ is the time complexity when there are $$$k$$$ zeroes in the mask
, then
(as there are (k-1) choices for j
)
Required: $$$T(n)$$$.
If that break
is removed, then
Lucky