Lynn Kamau 45/75 Blind Challenge Submission#102
Open
LynnMwende-Kamau wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Approach
Arrays & Hashing: Used HashMaps, Sets, prefix/suffix arrays, and greedy approaches for problems like Two Sum, Contains Duplicate, Product of Array Except Self, and Maximum Subarray.
Two Pointers / Sliding Window: Implemented two-pointer and sliding window techniques for problems such as Longest Substring Without Repeating Characters, Container With Most Water, Longest Repeating Character Replacement, and Minimum Window Substring.
Linked Lists: Traversed, reversed, and modified linked lists using iterative and recursive approaches. Solved Linked List Cycle, Merge Two Sorted Lists, Merge k Sorted Lists, Reorder List, Remove Nth Node From End, and Reverse Linked List.
Trees / BSTs: Applied DFS, BFS, recursion, and helper functions to solve problems like Invert Binary Tree, Maximum Depth of Binary Tree, Same Tree, Binary Tree Level Order Traversal, Subtree of Another Tree, Construct Binary Tree from Preorder & Inorder, Validate BST, Kth Smallest Element in BST, Lowest Common Ancestor, Binary Tree Maximum Path Sum, and Serialize/Deserialize Binary Tree.
Tries / Strings: Implemented Trie, Add/Search Words data structure, Encode/Decode Strings, Group Anagrams, Top K Frequent Elements, and Word Search/Word Search II.
Graphs: Solved Number of Islands using DFS.
Dynamic Programming: Tackled Climbing Stairs, House Robber, House Robber II, and Find Median from Data Stream using memoization, iterative DP, and heaps.
Backtracking: Combination Sum and Word Search problems solved using recursive backtracking with careful base case and path restoration.
Something I Learnt
Efficient use of HashMaps, Sets, Heaps, and Prefix/Suffix arrays greatly reduces complexity.
Sliding window techniques are extremely powerful for substring and subarray problems.
Recursion in Trees requires careful base cases and return values.
Dynamic Programming solutions require precise state definition and handling edge cases.
Backtracking requires undoing changes after recursive calls to explore all paths.
Trie and custom data structures help in optimizing searches over strings.
Challenges Faced
Indexing & off-by-one errors in arrays and strings.
Null pointer / NoneType issues in linked lists.
Recursion errors: incorrect base cases or wrong return values in trees and backtracking.
Edge cases on empty inputs or single-node trees/lists.
Sliding window shrinking logic mistakes causing incorrect substring lengths.
Mistakes in heap usage and managing min/max heaps for median finding.
Confusion over problem interpretation initially (e.g., Product of Array Except Self, single transaction vs multiple in Stock problem).