Notes

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/

// Do something instead of nothing, stay organised, stay ahead!, WRITE STUFF DOWN

// WA
// 1. overflow
// 2. re-initialize global variables for every test case.
// 3. edge cases like n=1

// Run time error
// 1. division by zero.
// 2. array bounds.

image

image

image

LeetCode Patterns

If input array is sorted then

If asked for all permutations/subsets then

If given a tree/graph then

If given a linked list then

If recursion is banned then

If must solve in-place then

If asked for maximum/minimum subarray/subset/options then

If asked for top/least K items then

If asked for common strings then

Else