Leetcode Problem Solving Steps
1. Document Understanding While Asking Clarifying Questions
1. Read the Problem and Restate Understanding
1. Inputs and their Data Types
2. Outputs and their Data Types
2. Clarifying Questions
1. Data Input State
1. What's the data type of the input and range of valid data?
2. How will input data be provided?
3. Is the input data sorted?
2. Data Quality
1. Can I expect to receive invalid data?
3. Data Size
1. Does the input data fit into memory?
4. Data Structure Specific Questions
1. [[LinkedLists]]
1. Are there any cycles expected to be in the LinkedLists?
2. [[Strings]]
1. What characters are in the strings?
3. Constraints
1. Size of Inputs and Outputs
2. Access Patterns for Inputs
3. Performance or Space Considerations
4. Edge Cases
1. Inputs:
1. Empty inputs (lists, strings, etc.)
2. Write Pseudo Code for Initial Solution
1. Documents variables needed
2. Address edge cases
3. Address main algorithm
1. Talk through example BEFORE writing code
3. Implement Initial Solution
1. Consider:
1. [[Performance]]
2. [[Space]]
4. Test Initial Solution
5. Assess and Apply Optimizations
6. Test Updated Solution
1. Review variable names
7. Submit