Foundations
Big O, arrays, Java collections tips and tree fundamentals.
6 pages
- Foundations: Big O & Arrays in JavaNote
Study note from the Foundations pattern set — Java templates, complexity analysis and the interview traps that come with it.
- Tree Data Structure Fundamentals in JavaNote
Before solving tree problems, ensure you are comfortable with: - The Node Class: How to define class TreeNode { int val; TreeNode left, right; }…
- LC 1929Concatenation of Array (LC 1929)Easy
Build a result array by repeating the original sequence once in the first half and once in the second half.
- LC 121Best Time to Buy and Sell Stock (LC 121)Easy
Track the lowest price seen so far; the best profit ending on each day is price today - min price so far.
- LC 238Product of Array Except Self (LC 238)Medium
answer[i] = (product of all elements to the left) × (product of all elements to the right); build prefix and suffix without using division.
- LC 41First Missing Positive (LC 41)Hard
The answer lies in [1, n] for array length n; place each valid number x at index x - 1, then scan for the first mismatch.