Skip to content

About

Python implementations of core algorithmic patterns and data structures, structured around NeetCode 150 for technical interview prep.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

leetcode-patterns

A personal repository for solving and organizing LeetCode 150 (Top Interview 150) and NeetCode 150 problems. The goal is to practice problem-solving patterns, keep the solutions, and add each completed problem to the project log.

Contents

Solutions are grouped by topic. More solutions will be added to the appropriate folders as they are completed.

Topic Recorded problems
Arrays and Hashing Contains Duplicate
Backtracking Subsets
Binary Search Binary Search
Linked List Reverse Linked List
Sliding Window Best Time to Buy and Sell Stock
Stack Valid Parentheses
Trees Invert Binary Tree
Tries Implement Trie (Prefix Tree)
Two Pointers Valid Palindrome

Solved problems

Problem Topic File
217. Contains Duplicate Arrays and Hashing 0217_Contains_Duplicate.py
78. Subsets Backtracking 0078_Subsets.py
704. Binary Search Binary Search 0704_Binary_Search.py
206. Reverse Linked List Linked List 0206_Reverse_Linked_List.py
121. Best Time to Buy and Sell Stock Sliding Window 0121_Best_Time_To_Buy_And_Sell_Stock.py
20. Valid Parentheses Stack 0020_Valid_Parentheses.py
226. Invert Binary Tree Trees 0226_Invert_Binary_Tree.py
208. Implement Trie (Prefix Tree) Tries 0208_Implement_Trie_Prefix_Tree.py
125. Valid Palindrome Two Pointers 0125_Valid_Palindrome.py

Running a solution

The current solutions are written in Python. From the repository root, you can run any of the files below:

python .\Arrays_and_Hashing\0217_Contains_Duplicate.py
python .\Backtracking\0078_Subsets.py
python .\Binary_Search\0704_Binary_Search.py
python .\Linked_List\0206_Reverse_Linked_List.py
python .\Sliding_Window\0121_Best_Time_To_Buy_And_Sell_Stock.py
python .\Stack\0020_Valid_Parentheses.py
python .\Trees\0226_Invert_Binary_Tree.py
python .\Tries\0208_Implement_Trie_Prefix_Tree.py
python .\Two_Pointers\0125_Valid_Palindrome.py

Each file includes simple tests that run when the file is executed directly.

Adding problems

  1. Save the solution in the folder for its topic.
  2. Name the file using the LeetCode problem number and a descriptive title, for example: 0217_Contains_Duplicate.py.
  3. Add the problem to the Contents and Solved problems tables.
  4. Include tests for important cases and, when possible, note the pattern used.

Practice topics

Problems from both lists will be added over time, covering areas such as arrays and hashing, two pointers, sliding window, stacks, binary search, linked lists, trees, graphs, dynamic programming, greedy algorithms, intervals, and math.

This log reflects only the problems added to this repository; it does not mean that either list has been completed.

About

Python implementations of core algorithmic patterns and data structures, structured around NeetCode 150 for technical interview prep.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages