Skip to content

Files

Latest commit

 

History

History
 
 

cheatsheet-leetcode-A4

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

1 CheatSheet: LeetCode Common Templates & Common Code Problems

linkedin
github
slack


PRs Welcome

File me Issues or star this repo.

1.1 Reference

NameSummary
CheatsheetCheatSheet: Leetcode For Code Interview, CheatSheet: Common Code Problems & Follow-ups
CheatsheetCheatSheet: System Design For Job Interview, CheatSheet: SRE/DevOps/Sysadmin
CheatsheetCheatSheet: Behavior Questions For Coder Interview
Leetcode summaryLink: Top Google Questions, Link: Top 100 Liked Questions, Link: Top Interview Questions
Leetcode summaryGitHub: kdn251/interviews, Github: Algorithms-and-Coding-Interviews
YouTubeHow to: Work at Google - Example Coding/Engineering Interview, lee 215, Aoxiang Cui, happygirlzt
Online test websiteshihocoder.com, codeforces.com, spoj.com, Google - codejam, hackerrank.com
Online test websiteshackerrank - hard, poj.org, acm.hdu.edu.cn, acm.zju.edu.cn, acm.timus.ru, uva.onlinejudge.org
visualgovisualizing data structures and algorithms through animation
Referencegeeksforgeeks.org, Youtube: Abdul Bari - Algorithm
ReferenceCOS 423 Theory of Algorithms, 6.006: Introduction to Algorithms - MIT

1.2 Top 25 Code Templates

NumCategory/TagExample
1#bfsLeetcode: Max Area of Island
2#dfsLeetCode: Surrounded Regions
3#binarysearchLeetCode: Search Insert Position
4#interval, #mergelistLeetCode: Interval List Intersections, Leetcode: Merge Intervals
5#twopointerLeetCode: Reverse Words in a String II, LeetCode: Two Sum
6#twopointer, #mergetwolistLeetCode: Merge Sorted Array, Leetcode: Container With Most Water
7#backtracking, #subsetLeetCode: Subsets II
8#linkedlist, #presumLeetCode: Remove Zero Sum Consecutive Nodes from Linked List
9#unionfindLeetCode: Accounts Merge
10#trieLeetCode: Longest Word in Dictionary
11#stackLeetCode: Valid Parentheses
12#heapLeetCode: Top K Frequent Elements
13#baseconversionLeetCode: Base 7, LeetCode: Convert to Base -2
14#intervalLeetCode: Meeting Rooms II, LeetCode: My Calendar I
15#monotoneLeetCode: Daily Temperatures
16#knapsackLeetCode: Coin Change
17#sortbyfunctionLeetCode: Relative Sort Array
18#slidingwindowLeetCode: Longest Substring Without Repeating Characters
19#editdistance, #dynamicprogrammingLeetCode: Longest Common Subsequence
20#topologicalsortLeetCode: Course Schedule
21#bfs, bidirectional bfsLeetCode: Word Ladder
22#monotonicfunc, #binarysearchLeetCode: Kth Smallest Number in Multiplication Table
23#divideconquer, #mergesortLeetcode: Count of Smaller Numbers After Self
24#linesweepLeetcode: The Skyline Problem, Leetcode: Employee Free Time
25#concurrencyLeetCode: Web Crawler Multithreaded

https://raw.githubusercontent.com/dennyzhang/cheatsheet.dennyzhang.com/master/cheatsheet-leetcode-A4/datastructre.png

1.3 Typical Followup

NumNameSummary
1From 1-D array to 2-D matrixLeetCode: Number of Submatrices That Sum to Target
2Instead of O(n) space, use O(1) spaceLeetCode: Find Mode in Binary Search Tree
3How to do it with multi-threadingLeetCode: Web Crawler Multithreaded
4Data values have different rangesLeetCode: Find Median from Data Stream
5Instead of a fixed list, it’s an ongoing data streamLeetcode: Flatten 2D Vector

1.4 Top 30 Graph Problems

NumProblemSummary
1Graph Connectivity: Count islands in a 2D matrixLeetCode: Number of Islands, LeetCode: Island Perimeter
2Get the size of the largest islandLeetCode: Max Area of Island
3Cycle detection in a directed graphLeetCode: Redundant Connection II
4Detect all cycles in a directed graphLeetCode: Find Eventual Safe States
5Whether a graph is a treeLeetCode: Graph Valid Tree
6Update a specific regionLeetCode: Flood Fill
7Graph trasversal from boardersLeetcode: Surrounded Regions
8Number of Distinct IslandsLeetCode: Number of Distinct Islands
9Mark levelsLeetCode: 01 Matrix
10Diameter of a tree in graph theoryLeetCode: Tree Diameter
11Duplicate edgesLeetCode: Reconstruct Itinerary
12Find a certain node in a graphLeetCode: Find the Celebrity
13Graph with next steps by a trieLeetcode: Word Search II
14Coloring graphLeetCode: Minesweeper
15Find a certain path from source to destination in a graphLeetCode: Path With Maximum Minimum Value
16Find the shortest distance from point1 to point2LeetCode: Word Ladder, LeetCode: Sliding Puzzle
17Find shortest distance in a weighted graphLeetCode: Find the City With the Smallest Number of Neighbors
18Find all minimum paths from point1 to point2LeetCode: Word Ladder II
19All Paths from Source Lead to DestinationLeetCode: All Paths from Source Lead to Destination
20Node connectivity problem for a sparse 2D matrixLeetCode: Escape a Large Maze
21Bricks Falling When HitLeetCode: Bricks Falling When Hit
22Bridges in a connected graph - Tarjan’s algorithmLeetCode: Critical Connections in a Network
23Valid & Invalid movesLeetCode: Alphabet Board Path
24Move in different directions: 4 directions, 8 directionsLeetCode: Queens That Can Attack the King
25String Transforms Into Another StringLeetCode: String Transforms Into Another String
26Candidates are (i, j, r), instead of (i, j)LeetCode: Shortest Path in a Grid with Obstacles Elimination
27Clone GraphLeetcode: Clone Graph
28Array problem with hidden graphLeetCode: Number of Squareful Arrays
29Is Graph BipartiteLeetCode: Is Graph Bipartite
30Search an infinite graphLeetCode: Escape a Large Maze
leetcode

1.5 Top 25 Binarysearch Problems

NumProblemSummary
1Find whether target in the rangeLeetCode: Guess Number Higher or Lower
2Find the first target with duplicatesLeetCode: First Bad Version
3Find the last target with duplicatesLeetCode: Longest Repeating Substring
4Find the first and last targetLeetCode: Find First and Last Position of Element in Sorted Array
5Search Insert PositionLeetCode: Search Insert Position, LeetCode: Time Based Key-Value Store
6Mountain ArrayLeetCode: Peak Index in a Mountain Array
7Missing Element in Sorted ArrayLeetCode: Missing Element in Sorted Array
8Find smallest letter greater than targetLeetCode: Find Smallest Letter Greater Than Target
9Random Point in Non-overlapping RectanglesLeetCode: Random Point in Non-overlapping Rectangles
10Binary search on monotonic functionLeetCode: Sqrt(x), LeetCode: Capacity To Ship Packages Within D Days
11Place k elements to minimize max distanceLeetCode: Minimize Max Distance to Gas Station
12Decide a numberLeetCode: Split Array Largest Sum
13Kth Smallest Number in Multiplication TableLeetCode: Kth Smallest Number in Multiplication Table
14Search for a RangeLeecode: Search for a Range
15Dynamic programming with binary searchLeetCode: Maximum Profit in Job Scheduling
16Montone stack with binary searchLeetCode: Maximum Width Ramp
17Find Right IntervalLeecode: Find Right Interval
18Patient sortLeetCode: Longest Increasing Subsequence
19Find Minimum in Rotated Sorted ArrayLeetCode: Find Minimum in Rotated Sorted Array
20Find Minimum in Rotated Sorted Array IILeetCode: Find Minimum in Rotated Sorted Array II
21Maximum Profit in Job SchedulingLeetcode: Maximum Profit in Job Scheduling
22Tweet Counts Per FrequencyLeetCode: Tweet Counts Per Frequency
23Median of Two Sorted ArraysLeetcode: Median of Two Sorted Arrays

1.6 Top 25 Dynamic Programming Problems

NumProblemTime ComplexitySummary
1Maximum subarray problem - Kadane’s algorithmO(n)LeetCode: Maximum Subarray
2LIS - Longest increasing subsequenceO(n)LeetCode: Longest Increasing Subsequence
3LCS - Longest Common SubsequenceO(n*m)LeetCode: Longest Common Subsequence
4LPS - Longest Palindromic SubsequenceO(n)LeetCode: Longest Palindromic Subsequence
5Longest Palindromic SubstringO(n^2)LeetCode: Longest Palindromic Substring
6Edit distance of two stringsO(n^2)LeetCode: Edit Distance
7Maximum profits with certain costsO(n^2)LeetCode: 4 Keys Keyboard
8Count of distinct subsequenceO(n)LeetCode: Distinct Subsequences II
9Count out of boundary paths in a 2D matrixO(n*m*N)LeetCode: Out of Boundary Paths
10Regular Expression MatchingO(n*m)LeetCode: Regular Expression Matching
11Wildcard MatchingO(n*m)LeetCode: Wildcard Matching
12Multiple choices for each stepO(n*m)LeetCode: Filling Bookcase Shelves
13Knapsack: put array to bag A, B or discard itO(n*s)LeetCode: Tallest Billboard
14Knapsack problem to maximize benefitsO(n*s)LeetCode: Coin Change
15Minimum Cost to Merge StonesO(n^3)LeetCode: Minimum Cost to Merge Stones
16DP over interval: Minimum-weight triangulationO(n^3)LeetCode: Minimum Score Triangulation of Polygon
17Burst BalloonsO(n^3)LeetCode: Burst Balloons
18Remove BoxesO(n^4)LeetCode: Remove Boxes
19Largest Sum of AveragesO(k*n*n)LeetCode: Largest Sum of Averages
20Uncrossed LinesO(n*m)LeetCode: Uncrossed Lines
21Binary Trees With FactorsO(n^2)LeetCode: Binary Trees With Factors

1.7 Top 20 BinaryTree Problems

NumProblemSummary
1Binary Tree Level Order TraversalLeetCode: Binary Tree Right Side View
2Tree Traversal: Binary Tree Vertical Order TraversalLeetCode: Binary Tree Vertical Order Traversal
3Tree Traversal: Find Leaves of Binary TreeLeetcode: Find Leaves of Binary Tree
4Get binary tree height, widthLeetCode: Balanced Binary Tree
5LCA - Lowest Common Ancestor of a binary TreeLeetCode: Lowest Common Ancestor of a Binary Tree
6Validate Binary Search TreeLeetCode: Validate Binary Search Tree
7Construct binary treeLeetCode: Construct Binary Tree from Preorder and Postorder Traversal
8Distribute Coins in Binary TreeLeetCode: Distribute Coins in Binary Tree
9Binary Tree Vertical Order TraversalLeetCode: Binary Tree Vertical Order Traversal
10Verify Preorder Sequence in Binary Search TreeLeetCode: Verify Preorder Sequence in Binary Search Tree
11Recursive + GreedyLeetCode: Binary Tree Coloring Game
12Binary tree + greedyLeetCode: Binary Tree Cameras
13Revert binary tree between left and right
14binary tree serialization and deserialization
15Morris tree trasversal
16Find the next node of binary search tree
17Count Complete Tree NodesLeetCode: Count Complete Tree Nodes
18Binary Tree Upside DownLeetcode: Binary Tree Upside Down
19Closest Binary Search Tree Value IILeetcode: Closest Binary Search Tree Value II

1.8 Top 10 String Problems

NumProblemSummary
1Edit distance of two stringsLeetCode: Edit Distance
2Remove duplicate lettersRemove Duplicate Letters
3Word ladderLeetCode: Word Ladder
4lrs - Longest repeating substringLeetCode: Longest Repeating Substring
5Remove CommentsLeetCode: Remove Comments
6Split Concatenated StringsLeetCode: Split Concatenated Strings
7Vowel SpellcheckerLeetCode: Vowel Spellchecker
8Lexicographically minimal string rotationLeetCode: Last Substring in Lexicographical Order
9String Transforms Into Another StringLeetCode: String Transforms Into Another String
10Find the Closest PalindromeLeetCode: Find the Closest Palindrome

1.9 Top 5 Stack Problems

NumProblemSummary
1Recursive deletion during pushing processLeetCode: Verify Preorder Serialization of a Binary Tree
2Examine whether the input string is validLeetCode: Asteroid Collision
3When pushing to stack, whether delayed pushLeetCode: Decode String

1.10 Top 5 Array Problems

NumProblemSummary
1Transpose MatrixLeetCode: Transpose Matrix
2Largest 1-Bordered SquareLeetCode: Largest 1-Bordered Square
3Alphabet Board PathLeetCode: Alphabet Board Path
4Set MismatchLeetCode: Set Mismatch
5Majority ElementLeetCode: Majority Element

1.11 Top 5 Linkedlist Problems

NumProblemSummary
1Merge k Sorted ListsLeetCode: Merge k Sorted Lists
2Detect cycle for a linked listLeetCode: Linked List Cycle
3Swap odd with even nodesLeetcode: Swap Nodes in Pairs
4LFU cache with double linkedlistLeetCode: LFU Cache

1.12 Top 10 Sliding Window Problems

NumProblemSummary
1Sliding window with fixed sizeLeetCode: Find All Anagrams in a String
2Sliding window with non-decreasing sizeLeetCode: Max Consecutive Ones III
3How to initialize the time window?LeetCode: Minimum Swaps to Group All 1’s Together
4Sliding window with non-decreasing sizeLeetCode: Max Consecutive Ones III
5Move two pointers: two loop vs One loopLeetCode: Longest Substring Without Repeating Characters
6Inspiring sliding window problemLeetCode: Moving Stones Until Consecutive II
7Sliding window with adjustable size
8Move pointer1 to match the other, or the other way around

1.13 Top 10 Math Problems

NumProblemSummary
1Check prime - Sieve of EratosthenesLeetCode: Count Primes
2Check leap yearLeetCode: Day of the Week
3GCDLeetCode: Fraction Addition and Subtraction
4Overlapping area of two rectanglesLeetCode: Rectangle Area
5Rotate Array by k stepsLeetCode: Rotate Array
6Mapping data range of getRand algorithmLeetCode: Implement Rand10() Using Rand7()
7Deal with floatLeetCode: Minimize Max Distance to Gas Station
8Sum of Subsequence WidthsLeetCode: Sum of Subsequence Widths
9Reduce f(x, y) to g(x)Leetcode: Maximum of Absolute Value Expression
10Remove 9LeetCode: Remove 9
11Fraction to Recurring DecimalLeetCode: Fraction to Recurring Decimal
12Check if two line segments intersect

1.14 Top 10 Greedy Problems

NumProblemSummary
1Next PermutationLeetCode: Next Permutation
2Split Array into Consecutive SubsequencesLeetCode: Split Array into Consecutive Subsequences
3Remove duplicate lettersRemove Duplicate Letters
4Bag of TokensLeetCode: Bag of Tokens
5Two City SchedulingLeetCode: Two City Scheduling
6Split Concatenated StringsLeetCode: Split Concatenated Strings
7Jump Game IILeetCode: Jump Game II
8Delete Columns to Make Sorted IILeetCode: Delete Columns to Make Sorted II

1.15 Top 5 Trie Problems

NumProblemSummary
1Extra datastructure in trie to save caculationLeetCode: Word Search II
2Trie for bit manipulationLeetCode: Maximum XOR of Two Numbers in an Array.
3Fuzzy match for trie treeLeetCode: Implement Magic Dictionary

1.16 Top 5 Union Find Problems

NumProblemSummary
1Union find for weighted graphLeetCode: Evaluate Division
2Union find: connect groups and merge node countLeetCode: Bricks Falling When Hit

1.17 Top 5 Heap/Priority Queue Problems

NumProblemSummary
1Meeting Rooms IILeetCode: Meeting Rooms II
2Task SchedulerLeetCode: Task Scheduler
3Last Stone WeightLeetCode: Last Stone Weight
4The Skyline ProblemLeetCode: The Skyline Problem

1.18 Top 5 Montone Stack/Queue Problems

NumProblemSummary
1Use monotone stack to find next bigger valueLeetCode: Next Greater Element I
2Monotone stack for consecutive subarraysLeetCode: Online Stock Span, LeetCode: Sum of Subarray Minimums
3Shortest Subarray with Sum at Least KLeetCode: Shortest Subarray with Sum at Least K
4Monotone queueLeetCode: Constrained Subset Sum, LeetCode: Sliding Window Maximum

1.19 Top 10 Backtracking Problems

NumProblemSummary
1Generate unique permutationLeetCode: Permutations II
2Permutation: All elements must takeLeetCode: Pyramid Transition Matrix
3Combination: All elements can take or don’t takeLeetCode: Subsets II
4Expression Add OperatorsLeetCode: Expression Add Operators
5Permutation vs CombinationLeetCode: Campus Bikes II
6Define dfs backtracking functionLeetCode: Verbal Arithmetic Puzzle

1.20 Top 20 Object-Oriented Design Problems

NumProblemExample
1CacheLeetCode: LRU Cache, LeetCode: LFU Cache, LeetCode: All O`one Data Structure
2ThrottlingLeetCode: Design Hit Counter, LeetCode: Logger Rate Limiter
3Design Log Storage SystemLeetCode: Design Log Storage System
4Linked List with random accessLeetCode: Design Linked List
5Max StackLeetCode: Max Stack
6Design HashMapLeetCode: Design HashMap
7Circular QueueLeetCode: Design Circular Queue, LeetCode: Design Circular Deque
8Trie treeLeetCode: Implement Trie (Prefix Tree), LeetCode: Add and Search Word
9Get MedianLeetCode: Find Median from Data Stream
10Range Sum QueryLeetCode: Range Sum Query - Mutable, LeetCode: Range Sum Query - Immutable
11Design File SystemLeetCode: Design File System
12Tree IteratorLeetCode: Binary Search Tree Iterator
13String IteratorLeetCode: Design Compressed String Iterator
14ZigZag IteratorLeetCode: Zigzag Iterator
15Insert Delete GetRandom O(1)LeetCode: Insert Delete GetRandom O(1)
16Insert Delete GetRandom O(1) IILeetCode: Insert Delete GetRandom O(1) - Duplicates allowed
17Random Pick with BlacklistLeetCode: Random Pick with Blacklist

1.21 Top 50 General Problems

NumProblemExample
1Longest substring with at most K distinct charactersLeetCode: Longest Substring with At Most K Distinct Characters
2Longest subarray with maximum K 0sLeetCode: Max Consecutive Ones III
3Seperate a list into several groupsLeetCode: Summary Ranges
4Split stringLeetCode: License Key Formatting
5TopK problemLeetCode: Top K Frequent Elements, LeetCode: Find K Pairs with Smallest Sums
6Longest Palindromic SubsequenceLeetCode: Longest Palindromic Subsequence
7Sort one array based on another arrayLeetCode: Relative Sort Array
8Range update with lazy propagationLeetCode: Corporate Flight Bookings
9Sliding window with lazy removalLeetcode: Sliding Window Median
10Get all possibilities of subsetsLeetCode: Subsets II, LeetCode: Subsets
11Choose k numbers from a listLeetCode: Combination Sum II
12Combination from multiple segmentsLeetCode: Letter Combinations of a Phone Number
13Remove nodes from linked listLeetCode: Remove Zero Sum Consecutive Nodes from Linked List
14Two pointersLeetCode: Two Sum
15Buy stock for maximum profit listLeetCode: Best Time to Buy and Sell Stock
16Prefix search from a list of stringsLeetCode: Longest Word in Dictionary
17Factor CombinationsLeetCode: Factor Combinations
18Permutation without duplicatesLeetCode: Palindrome Permutation II
19Convert a number into negative base representationLeetCode: Convert to Base -2
20Network connectivityLeetCode: Friend Circles
21Build relationship among different setsLeetCode: Accounts Merge
22Find the next greater valueLeetCode: Daily Temperatures
23Meeting conflictLeetCode: Meeting Rooms, LeetCode: Course Schedule
24Minimum conference roomsLeetCode: Meeting Rooms II
25Quick slow pointersLintCode: Middle of Linked List
26Longest Repeating Character with at most K changesLeetCode: Longest Repeating Character Replacement
27Prefix and Suffix SearchLeetCode: Prefix and Suffix Search
28Remove duplicate lettersLeetCode: Remove Duplicate Letters
29Beautiful arrayLeetCode: Beautiful Array
30Whether 132 pattern exists in arrayLeetCode: 132 Pattern
31Detect conflicts of intervalsLeetCode: Non-overlapping Intervals
32Segment tree: solves range query problems quicklyLeetCode: Range Sum Query - Mutable
33Find best meeting points for a list of nodesLeetCode: Best Meeting Point
34Find the size of longest wiggle subsequenceLeetCode: Wiggle Subsequence
35Sequence reconstructionLeetCode: Sequence Reconstruction
36Construct Binary Tree from StringConstruct Binary Tree from String
37Use more space to save timeLeetCode: Min Stack
38Min max game problemsLeetCode: Predict the Winner, LeetCode: Stone Game
39Shortest Subarray with Sum at Least KLeetCode: Shortest Subarray with Sum at Least K
40Wiggle sortLeetCode: Wiggle Sort II
41Array compressed storageLeetCode: Design Tic-Tac-Toe
42Dead lock: the Dining PhilosophersLeetCode: The Dining Philosophers
43Maintain the orderLeetCode: Building H2O
44Int to string or string to int
45Expression Add OperatorsLeetCode: Expression Add Operators
46Merge k Sorted ListsLeetCode: Merge k Sorted Lists
47Trapping Rain WaterLeetCode: Trapping Rain Water

1.22 Basic Thinking Methodologies

NumNameSummary
1Trial and error
2Divide and Conquer
3Start with naive algorithm, then identify useless steps

1.23 Tips: Think From The Other Direction

NumNameSummary
1In graph, instead of deleting edges, add edge in reverseLeetCode: Bricks Falling When Hit
2Instead of BFS from empty to islands, do the otherwiseLeetCode: As Far from Land as Possible
3Treat each point as the last item, instead of the firstLeetCode: Burst Balloons
4Avoid deleting element from hashmaps

1.24 Common Tips For Clean Code

NumNameSummary
1Calculate sum of a range quickly#presum,LeetCode: Maximum Subarray
2Move in four directions for a matrixLeetCode: Sliding Puzzle
3Split string by multiple separatorsLeetCode: Brace Expansion
4Add a dummy tailing element to simplify codeLeetCode: Brace Expansion
5Fast slow pointersLintCode: Middle of Linked List
6Deep copy an arrayLeetCode: Combination Sum
7Use arrays instead of hashmaps, if possibleLeetCode: Number of Days in a Month
8Control the order of dfsLeetCode: Subsets II
9Avoid inserting into the head of an arrayLeetCode: Path In Zigzag Labelled Binary Tree
10From right to left, instead of left to rightLeetCode: Merge Sorted Array
11Think the other way aroundAdd Items vs Remove Items, Increase Counter vs Decrease Counter
12Avoid unnecessary if…else…res[i] = (diff/2 <= k), LeetCode: Can Make Palindrome from Substring
13To get the case of K, solve: at most K - at most (K-1)LeetCode: Subarrays with K Different Integers
14Instead of deleting entry from hashmap, decrease counterLeetCode: Longest Substring with At Most K Distinct Characters
15Find the max/min; If not found, return 0LeetCode: Minimum Area Rectangle
16With helper function vs without helper functionLeetCode: Longest Repeating Character Replacement
17Instead of adding a character, try to delete oneLeetCode: Longest String Chain
18#roudtrippass: from left to right, then right to leftLeetCode: Shortest Distance to a Character
19Delayed calculation to simplify the codeLeetCode: Interval List Intersections
20Instead of removing, add padding elementsLeetCode: Duplicate Zeros
21Initialize array with n+1 length to simplify codeLeetCode: Range Addition
22Look for off-by-one errors, sometimes use i+1<len(l) vs i<len(l)LeetCode: Previous Permutation With One Swap
23Hashmap can reduce calculation, but may complicate things tooLeetCode: Maximum Frequency Stack
24Sliding window to get the longest size of subarrayLeetCode: Max Consecutive Ones III
25In matrix dfs, change cell to impossible value to avoid state hashmapLeetCode: Word Search II
26For palindrome check, check the whole string, instead of left halfLeetCode: Longest Chunked Palindrome Decomposition
27Use queue to keep flipping the ordersLeetCode: Zigzag Iterator
28Find a pair with sum meets some requirementsLeetCode: Two Sum
29Add a dummy head node for linked listLeetCode: Reverse Linked List
30When count sort, use one array instead of twoLeetCode: Minimum Number of Steps to Make Two Strings Anagram
31Hide details which are irrelevant
32One pass instead of two pass
33Avoid unnecessary precheck
34Reduce search spaceLeetcode: Bulb Switcher II

1.25 More Resources

License: Code is licensed under MIT License.

https://en.wikipedia.org/wiki/Data_structure

https://www.cs.princeton.edu/~rs/AlgsDS07/

https://www.geeksforgeeks.org/top-10-algorithms-in-interview-questions/