Barcelona | Oct-2025 | Angela Onyekwelu | Module- Complexity |Sprint 2 - #2
Open
theangelskies wants to merge 8 commits into
Open
Barcelona | Oct-2025 | Angela Onyekwelu | Module- Complexity |Sprint 2#2theangelskies wants to merge 8 commits into
theangelskies wants to merge 8 commits into
Conversation
… caching for improved performance
…x computation and optimize count_letters to avoid rescanning the input string
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.
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Sprint 2: linked list, LRU cache, skip list, caching, and precomputing exercises
push_head,pop_tail,remove) with O(1) worst-case operationsget/set/eviction) on top of a hash map + doubly linked list, all O(1)insert,contains,to_list) with O(log n) expected insert/containsfibonacciandways_to_make_changewith iterative bottom-up caching, avoiding bothexponential blowup and Python recursion-depth limits on large inputs
find_longest_common_prefix(trie-based, O(total characters) instead of pairwiseO(n²) comparison) and
count_letters(precomputed character set instead of rescanning thestring per upper-case letter)
Test plan
implement_linked_list: all tests pass (incl. 2 added: remove-head, pop_tail-on-empty)implement_lru_cache: all tests pass (incl. 2 added: update-existing-key, limit=1)implement_skip_list: all tests pass (incl. 2 added: empty list, out-of-order duplicates)improve_with_caches: fibonacci and making_change tests pass; making_change test_9176dropped from ~21s to milliseconds
improve_with_precomputing: count_letters tests pass, verified O(n) on a 10M-char string(~0.15s)
Questions
Ask any questions you have for your reviewer. You must remove this section if you have no questions.