GithubHelp home page GithubHelp logo

coding-interview-practice's Introduction

Introduction

This repository contains a list of detailed posts and solutions for data structure and algorithm related problems.

Below is a table of LeetCode posts. The posts span from 05/2020 through present. Over this time frame the quality of the solutions gradually progress from novice (05/2020 - 08/2020) to intermediate (08/2020 - 11/2020) to expert (11/2020 - present).

The problem number links to the problem statement and the solution links to my discussion post / solution.

About 10% of the posts require a LeetCode membership to view, the rest do not.

This repository also contains a folder called old_practice_problems. The folder contains older solutions (02/2020) and my thought process approaching the problem for the first time.

Aside

The progression in quality of the posts below is closely linked to my progression in competitive programmimg (shown here) which can be compared to a larger population of programmers (shown here).

LeetCode Posts

Problem Title and Solution Solution Type
59 spiral matrix ii Arrays
750 number of corner rectangles Arrays
764 largest plus sign Arrays
908 smallest range i Arrays
922 sort array by parity ii Arrays
1031 maximum sum of two non overlapping subarrays Arrays
1385 find the distance value between two arrays Arrays
1441 build an array with stack operations Arrays
1292 maximum side length of a square with sum less than or equal to threshold Arrays
Binary Search
5 longest palindromic substring Binary Search
275 h index ii Binary Search
483 smallest good base Binary Search
718 maximum length of repeated subarray Binary Search
825 friends of appropriate ages Binary Search
1095 find in mountain array Binary Search
1283 find the smallest divisor given a threshold Binary Search
1428 leftmost column with at least a one Binary Search
1618 maximum font to fit a sentence in a screen Binary Search
99 recover binary search tree Binary Search Trees (BST)
510 inorder successor in bst ii Binary Search Trees (BST)
1146 snapshot array Binary Search
Design Data Structure
508 most frequent subtree sum Binary Trees
814 binary tree pruning Binary Trees
1022 sum of root to leaf binary numbers Binary Trees
1080 insufficient nodes in root to leaf paths Binary Trees
1379 find a corresponding node of a binary tree in a clone of that tree Binary Trees
1430 check if a string is a valid sequence from root to leaves path in a binary tree Binary Trees
1318 minimum flips to make a or b equal to c Bit Manipulation
568 maximum vacation days Breadth First Search (BFS)
650 2 keys keyboard Breadth First Search (BFS)
752 open the lock Breadth First Search (BFS)
818 race car Breadth First Search (BFS)
882 reachable nodes in subdivided graph Breadth First Search (BFS)
1036 escape a large maze Breadth First Search (BFS)
1145 binary tree coloring game Breadth First Search (BFS)
1219 path with maximum gold Breadth First Search (BFS)
1284 minimum number of flips to convert binary matrix to zero matrix Breadth First Search (BFS)
1368 minimum cost to make at least one valid path in a grid Breadth First Search (BFS)
1601 maximum number of achievable transfer requests Breadth First Search (BFS)
1602 find nearest right node in binary tree Breadth First Search (BFS)
1660 correct a binary tree Breadth First Search (BFS)
1730 shortest path to get food Breadth First Search (BFS)
504 base 7 Change of Base
51 n queens Depth First Search (DFS)
698 partition to k equal sum subsets Depth First Search (DFS)
1020 number of enclaves Depth First Search (DFS)
Breadth First Search (BFS)
641 design circular deque Design Data Structure
933 number of recent calls Design Data Structure
273 integer to english words Divide and Conquer
70 climbing stairs Dynamic Programming
375 guess number higher or lower ii Dynamic Programming
377 combination sum iv Dynamic Programming
464 can i win Dynamic Programming
486 predict the winner Dynamic Programming
494 target sum Dynamic Programming
629 k inverse pairs array Dynamic Programming
639 decode ways ii Dynamic Programming
746 min cost climbing stairs Dynamic Programming
801 minimum swaps to make sequences increasing Dynamic Programming
813 largest sum of averages Dynamic Programming
983 minimum cost for tickets Dynamic Programming
1024 video stitching Dynamic Programming
1025 divisor game Dynamic Programming
1027 longest arithmetic subsequence Dynamic Programming
1216 valid palindrome iii Dynamic Programming
1235 maximum profit in job scheduling Dynamic Programming
1307 verbal arithmetic puzzle Dynamic Programming
1312 minimum insertion steps to make a string palindrome Dynamic Programming
1690 stone game vii Dynamic Programming
1692 count ways to distribute candies Dynamic Programming
431 encode n ary tree to binary tree Encoding and Decoding
N-ary Trees
Binary Trees
865 smallest subtree with all the deepest nodes Eulerian Path
1650 lowest common ancestor of a binary tree iii Eulerian Path
1676 lowest common ancestor of a binary tree iv Eulerian Path
1740 find distance in a binary tree Eulerian Path
Visual Solutions
307 range sum query mutable Fenwick Trees
683 k empty slots Fenwick Trees
1606 find servers that handled most number of requests Fenwick Trees
317 shortest distance from all buildings Floyd-Warshall
Breadth First Search (BFS)
348 design tic tac toe Game Related
529 minesweeper Game Related
909 snakes and ladders Game Related
950 reveal cards in increasing order Game Related
1210 minimum moves to reach target with rotations Game Related
Breadth First Search (BFS)
538 convert bst to greater tree Greater Trees
765 couples holding hands Greedy
995 minimum number of k consecutive bit flips Greedy
1090 largest values from labels Greedy
1686 stone game vi Greedy
132 palindrome partitioning ii Greedy Algorithm
1349 maximum students taking exam Greedy Algorithm
1147 longest chunked palindrome decomposition Greedy
Double Ended Queues
296 best meeting point Greedy
Greedy Algorithm
727 minimum window subsequence Greedy
Greedy Algorithm
149 max points on a line Hashing
893 groups of special equivalent strings Hashing
871 minimum number of refueling stops Heap
1696 jump game vi Heap
1655 distribute repeating integers Heap
Breadth First Search (BFS)
798 smallest rotation with highest score Interval Scheduling:
25 reverse nodes in k group Linked-Lists
82 remove duplicates from sorted list ii Linked-Lists
430 flatten a multilevel doubly linked list Linked-Lists
708 insert into a sorted circular linked list Linked-Lists
1290 convert binary number in a linked list to integer Linked-Lists
1634 add two polynomials represented as linked lists Linked-Lists
448 find all numbers disappeared in an array Masks
864 shortest path to get all keys Masks
Breadth First Search (BFS)
526 beautiful arrangement Masks
Top Down DP
474 ones and zeroes Memoization
308 range sum query 2d mutable Memoization
Fenwick Trees
423 reconstruct original digits from english Multiset
1742 maximum number of balls in a box Multiset
1745 palindrome partitioning iv Multiset
Prefix Sum Array
1623 all valid triplets that can represent a country MySQL
1633 percentage of users attended a contest MySQL
1667 fix names in a table MySQL
1693 daily leads and partners MySQL
1490 clone n ary tree N-ary Trees
1506 find root of n ary tree N-ary Trees
1600 throne inheritance N-ary Trees
1257 smallest common region N-ary Trees
Lowest Common Ancestor
15 3sum Other
32 longest valid parentheses Other
118 pascals triangle Other
248 strobogrammatic number iii Other
268 missing number Other
306 additive number Other
350 intersection of two arrays ii Other
396 rotate function Other
760 find anagram mappings Other
775 global and local inversions Other
780 reaching points Other
800 similar rgb color Other
821 shortest distance to a character Other
843 guess the word Other
858 mirror reflection Other
884 uncommon words from two sentences Other
887 super egg drop Other
1001 grid illumination Other
1015 smallest integer divisible by k Other
1054 distant barcodes Other
1138 alphabet board path Other
1217 minimum cost to move chips to the same position Other
1253 reconstruct a 2 row binary matrix Other
1266 minimum time visiting all points Other
1291 sequential digits Other
1360 number of days between two dates Other
1455 check if a word occurs as a prefix of any word in a sentence Other
1488 avoid flood in the city Other
1503 last moment before all ants fall out of a plank Other
1599 maximum profit of operating a centennial wheel Other
1610 maximum number of visible points Other
1653 minimum deletions to make string balanced Other
1743 restore the array from adjacent pairs Other
1386 cinema seat allocation Other
Greedy
399 evaluate division Path Finding
573 squirrel simulation Path Finding
18 4sum Pointers
713 subarray product less than k Pointers
334 increasing triplet subsequence Prefix Sum Array
1714 sum of special evenly spaced elements in array Prefix Sum Array
1744 can you eat your favorite candy on your favorite day Prefix Sum Array
688 knight probability in chessboard Probability
808 soup servings Probability
1377 frog position after t seconds Probability
616 add bold tag in string Rabin-Karp
1316 distinct echo substrings Rabin-Karp
773 sliding puzzle Rabin-Karp
Breadth First Search (BFS)
130 surrounded regions Recursion
131 palindrome partitioning Recursion
139 word break Recursion
140 word break ii Recursion
463 island perimeter Recursion
906 super palindromes Recursion
1088 confusing number ii Recursion
1301 number of paths with max score Recursion
1548 the most similar path in a graph Recursion
1612 check if two expression trees are equivalent Recursion
Breadth First Search (BFS)
546 remove boxes Recursion
Memoization
1240 tiling a rectangle with the fewest squares Recursion
Simulation
732 my calendar iii Scheduling:
1157 online majority element in subarray Segment Tree
1673 find the most competitive subsequence Segment Tree
1335 minimum difficulty of a job schedule Segment Tree
Dynamic Programming
794 valid tic tac toe state Simulation
Game Related
749 contain virus Simulation
Union-Find
Visual Solutions
1206 design skiplist Skip List
1100 find k length substrings with no repeated characters Sliding Window
1708 largest subarray length k Sliding Window
646 maximum length of pair chain Sorting
757 set intersection size at least two Sorting
1333 filter restaurants by vegan friendly price and distance Sorting
1356 sort integers by the number of 1 bits Sorting
220 contains duplicate iii Sorting
Double Ended Queues
20 valid parentheses Stacks
71 simplify path Stacks
85 maximal rectangle Stacks
503 next greater element ii Stacks
604 design compressed string iterator Stacks
1598 crawler log folder Stacks
1106 parsing a boolean expression Stacks
Parsing
188 best time to buy and sell stock iv State Machines
265 paint house ii State Machines
276 paint fence State Machines
740 delete and earn State Machines
161 one edit distance String Manipulation
186 reverse words in a string ii String Manipulation
395 longest substring with at least k repeating characters String Manipulation
557 reverse words in a string iii String Manipulation
811 subdomain visit count String Manipulation
824 goat latin String Manipulation
856 score of parentheses String Manipulation
859 buddy strings String Manipulation
1236 web crawler String Manipulation
454 4sum ii Sub-problem
1242 web crawler multithreaded Threading:
Breadth First Search (BFS)
312 burst balloons Top Down DP
329 longest increasing path in a matrix Top Down DP
337 house robber iii Top Down DP
471 encode string with shortest length Top Down DP
913 cat and mouse Top Down DP
955 delete columns to make sorted ii Top Down DP
956 tallest billboard Top Down DP
1043 partition array for maximum sum Top Down DP
1125 smallest sufficient team Top Down DP
1340 jump game v Top Down DP
1420 build array where you can find the maximum exactly k comparisons Top Down DP
1449 form largest integer with digits that add up to target Top Down DP
1473 paint house iii Top Down DP
1659 maximize grid happiness Top Down DP
1681 minimum incompatibility Top Down DP
1682 longest palindromic subsequence ii Top Down DP
1691 maximum height by stacking cuboids Top Down DP
1728 cat and mouse ii Top Down DP
1406 stone game iii Top Down DP
Game Related
164 maximum gap Trie
745 prefix and suffix search Trie
820 short encoding of words Trie
1016 binary string with substrings representing 1 to n Trie
1178 number of valid words for each puzzle Trie
1233 remove sub folders from the filesystem Trie
127 word ladder Trie
Breadth First Search (BFS)
1397 find all good strings Trie
Top Down DP
839 similar string groups Trie
Union-Find
80 remove duplicates from sorted array ii Two-pointer
1287 element appearing more than 25 in sorted array Two-pointer
1580 put boxes into the warehouse ii Two-pointer
128 longest consecutive sequence Union-Find
261 graph valid tree Union-Find
305 number of islands ii Union-Find
547 friend circles Union-Find
711 number of distinct islands ii Union-Find
721 accounts merge Union-Find
737 sentence similarity ii Union-Find
924 minimize malware spread Union-Find
928 minimize malware spread ii Union-Find
990 satisfiability of equality equations Union-Find
1061 lexicographically smallest equivalent string Union-Find
1101 the earliest moment when everyone become friends Union-Find
1168 optimize water distribution in a village Union-Find
1202 smallest string with swaps Union-Find
1258 synonymous sentences Union-Find
1319 number of operations to make network connected Union-Find
1579 remove max number of edges to keep graph fully traversable Union-Find
1627 graph connectivity with threshold Union-Find
1632 rank transform of a matrix Union-Find
1697 checking existence of edge length limited paths Union-Find
352 data stream as disjoint intervals Union-Find
Binary Search
1434 number of ways to wear different hats to each other Union-Find
Top Down DP
959 regions cut by slashes Union-Find
Visual Solutions
172 factorial trailing zeroes Visual Solutions
319 bulb switcher Visual Solutions
498 diagonal traverse Visual Solutions
790 domino and tromino tiling Visual Solutions
963 minimum area rectangle ii Visual Solutions
1351 count negative numbers in a sorted matrix Visual Solutions
1644 lowest common ancestor of a binary tree ii Visual Solutions
Binary Trees
Eulerian Path
1274 number of ships in a rectangle Visual Solutions
Divide and Conquer

coding-interview-practice's People

Contributors

lprowe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.