1. BITT Principle
Brute Force （暴力解法，低效/费空间）
Time and space complexity （时间/空间复杂度）
2. Array is sorted and may have better performance （3Sum o(n^2) solution)
3. Test cases are designed on purpose to test the functionality, not randomly selected.
In the example of 3sum problem,
test cases could be:
0, 1, 2 elements for input array to test shorter array than the requirement
[1, 0, 1] for no matched triplets
[-1, -1, -1, 2, 2, 2, 2] for many duplicate triplets
Donate $5 to me for a coffee with PayPal
and read more professional and interesting technical blog articles. Feel free to visit my web app, WhizWallet
, to apply for credit, store or gift cards, DealsPlus
to browse daily deals and store coupons to save money.
Follow me @Yaoli0615
at Twitter to get latest tech updates.
Ruminations on C++: A Decade of Programming Insight and Experience