Sum Rule : when the events cannot happen at the same timeProduct Rule : when the events happen in conjunction AND the number of leaves for each branch of the problem space tree is the sameHow to classify the problem space into events/sets : Ru..
1 ~ n : n itemsThis is easy. You only need to read the last item's number to get the number of items.8 ~ 11 : 4 numbers11 - 8 = 3 numbers? WRONG!!! Why? Subtraction = the number of spans between numbers, NOT a count of how m..
- Proof of Correctness
- Two Pointer