Skip to content

sachin-kumar-2003/leetcode75

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode 75 - Complete Solutions Collection

A comprehensive collection of solutions for the LeetCode 75 study plan, covering fundamental algorithms and data structures essential for technical interviews.

🎯 Overview

This repository contains 75 carefully selected LeetCode problems that cover the most important concepts in algorithms and data structures.

πŸ“Š Problem Categories

Category Count Problems
Array/String 20 Two pointers, sliding window, prefix sum
Two Pointers 8 Array manipulation, collision detection
Sliding Window 7 Fixed/variable window techniques
Stack 5 Monotonic stack, parentheses matching
Binary Tree 12 DFS, BFS, tree traversals
Binary Search Tree 3 Search, insertion, deletion
Graph 5 DFS, BFS, shortest path
Heap/Priority Queue 3 K-largest elements, scheduling
Backtracking 3 Combinations, permutations
Dynamic Programming 12 1D/2D DP, state transitions
Greedy 3 Optimal choices at each step
Bit Manipulation 3 XOR, bit masking
Trie 2 Prefix matching, autocomplete
Intervals 2 Merging, scheduling

πŸ—‚οΈ Solutions Structure

leetcode75/
β”œβ”€β”€ 01-25/           # Easy problems
β”œβ”€β”€ 26-50/           # Medium problems  
β”œβ”€β”€ 51-75/           # Hard problems
└── README.md

πŸš€ Getting Started

Prerequisites

  • Python 3.6+
  • No external dependencies required

Running Solutions

# Clone the repository
git clone https://github.com/sachin-kumar-2003/leetcode75.git
cd leetcode75

πŸ“‹ Problem List

🟒 Easy Problems (25)

# Problem Solution Topics
1 Merge Strings Alternately 01_mergeAlternately.py Two Pointers
2 Greatest Common Divisor of Strings 02_gcdOfStrings.py Math
3 Kids With the Greatest Number of Candies 03_kidsWithCandies.py Array
4 Can Place Flowers 04_canPlaceFlowers.py Greedy
5 Reverse Words in a String III 05_reverseWords.py Two Pointers
6 Reverse Vowels of a String 06_reverseVowels.py Two Pointers
7 Product of Array Except Self 07_productExceptSelf.py Array
8 Increasing Triplet Subsequence 08_increasingTriplet.py Greedy
9 String Compression 09_compress.py Two Pointers
10 Move Zeroes 10_moveZeroes.py Array
11 Is Subsequence 11_isSubsequence.py Two Pointers
12 Container With Most Water 12_maxArea.py Two Pointers
13 Max Number of K-Sum Pairs 13_maxOperations.py Hash Table
14 Maximum Average Subarray I 14_findMaxAverage.py Sliding Window
15 Maximum Number of Vowels in a Substring 15_maxVowels.py Sliding Window
16 Longest Subarray of 1's After Deleting One Element 16_longestOnes.py Sliding Window
17 Longest Subarray With Maximum Bitwise AND 17_longestSubarray.py Bit Manipulation
18 Find the Highest Altitude 18_largestAltitude.py Prefix Sum
19 Find Pivot Index 19_pivotIndex.py Prefix Sum
20 Find the Difference of Two Arrays 20_findDifference.py Hash Table
21 Unique Number of Occurrences 21_uniqueOccurrences.py Hash Table
22 Determine if Two Strings Are Close 22_closeStrings.py Hash Table
23 Equal Row and Column Pairs 23_equalPairs.py Hash Table
24 Removing Stars From a String 24_removeStars.py Stack
25 Asteroid Collision 25_asteroidCollision.py Stack

🟑 Medium Problems (35)

# Problem Solution Topics
26 Decode String 26_decodeString.py Stack
27 Recent Counter 27_RecentCounter.py Queue
28 Predict the Winner 28_predictPartyVictory.py DP
29 Delete the Middle Node of a Linked List 29_deleteMiddle.py Linked List
30 Odd Even Linked List 30_oddEvenList.py Linked List
31 Reverse Linked List 31_reverseList.py Linked List
32 Maximum Twin Sum of a Linked List 32_pairSum.py Linked List
33 Maximum Depth of Binary Tree 33_maxDepth.py Binary Tree
34 Leaf-Similar Trees 34_leafSimilar.py Binary Tree
35 Count Good Nodes in Binary Tree 35_goodNodes.py Binary Tree
36 Path Sum III 36_pathSum.py Binary Tree
37 Longest ZigZag Path in a Binary Tree 37_longestZigZag.py Binary Tree
38 Lowest Common Ancestor of a Binary Tree 38_lowestCommonAncestor.py Binary Tree
39 Binary Tree Right Side View 39_rightSideView.py Binary Tree
40 Maximum Level Sum of a Binary Tree 40_maxLevelSum.py Binary Tree
41 Search in a Binary Search Tree 41_searchBST.py Binary Search Tree
42 Delete Node in a BST 42_deleteNode.py Binary Search Tree
43 Keys and Rooms 43_canVisitAllRooms.py Graph
44 Number of Provinces 44_findCircleNum.py Graph
45 Reorder Routes to Make All Paths Lead to the City Zero 45_minReorder.py Graph
46 Evaluate Division 46_calcEquation.py Graph
47 Nearest Exit from Entrance in Maze 47_nearestExit.py Graph
48 Rotting Oranges 48_orangesRotting.py Graph
49 Kth Largest Element in an Array 49_findKthLargest.py Heap
50 Smallest Infinite Set 50_SmallestInfiniteSet.py Heap
51 Maximum Score After Splitting a String 51_maxScore.py Greedy
52 Total Cost to Hire K Workers 52_totalCost.py Heap
53 Guess Number Higher or Lower 53_guessNumber.py Binary Search
54 Successful Pairs of Spells and Potions 54_successfulPairs.py Binary Search
55 Find Peak Element 55_findPeakElement.py Binary Search
56 Koko Eating Bananas 56_minEatingSpeed.py Binary Search
57 Letter Combinations of a Phone Number 57_letterCombinations.py Backtracking
58 Combination Sum III 58_combinationSum3.py Backtracking
59 N-th Tribonacci Number 59_tribonacci.py Dynamic Programming
60 Min Cost Climbing Stairs 60_minCostClimbingStairs.py Dynamic Programming
61 House Robber 61_rob.py Dynamic Programming
62 Domino and Tromino Tiling 62_numTilings.py Dynamic Programming
63 Unique Paths 63_uniquePaths.py Dynamic Programming
64 Longest Common Subsequence 64_longestCommonSubsequence.py Dynamic Programming
65 Best Time to Buy and Sell Stock 65_maxProfit.py Dynamic Programming
66 Edit Distance 66_minDistance.py Dynamic Programming
67 Counting Bits 67_countBits.py Bit Manipulation
68 Single Number 68_singleNumber.py Bit Manipulation
69 Minimum Flips to Make a OR b Equal to c 69_minFlips.py Bit Manipulation
70 Implement Trie (Prefix Tree) 70_Trie.py Trie
71 Search Suggestions System 71_suggestedProducts.py Trie
72 Non-overlapping Intervals 72_eraseOverlapIntervals.py Intervals
73 Minimum Number of Arrows to Burst Balloons 73_findMinArrowShots.py Intervals
74 Daily Temperatures 74_dailyTemperatures.py Stack
75 Online Stock Span 75_StockSpanner.py Stack

🎯 Problem-Solving Patterns

Array/String Patterns

  • Two Pointers: Use two indices moving towards/away from each other
  • Sliding Window: Maintain a window of elements with left/right pointers
  • Prefix Sum: Pre-calculate cumulative sums for range queries

Tree Patterns

  • DFS: Depth-first traversal (preorder, inorder, postorder)
  • BFS: Level-order traversal using queue
  • Recursion: Natural fit for tree problems

Dynamic Programming Patterns

  • 1D DP: Single dimension state
  • 2D DP: Two dimensions state (strings, grids)
  • State transitions: Build solution from smaller subproblems

πŸš€ Performance Optimization Tips

Time Optimization

  • Avoid nested loops when possible
  • Use hash maps for O(1) lookups
  • Pre-calculate values that are used multiple times

Space Optimization

  • In-place modifications to reduce extra space
  • Re-use data structures instead of creating new ones
  • Bit manipulation for compact storage

πŸ“š Learning Path

Beginner Path (Problems 1-25)

Start with easy problems to build fundamentals:

  1. Array manipulation techniques
  2. Two pointer patterns
  3. Basic data structures (stack, queue)

Intermediate Path (Problems 26-50)

Progress to medium problems:

  1. Linked list operations
  2. Tree traversals and operations
  3. Graph algorithms (DFS, BFS)

Advanced Path (Problems 51-75)

Master complex algorithms:

  1. Dynamic programming patterns
  2. Backtracking techniques
  3. Advanced data structures (trie, heap)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages