Skip to content

πŸ§‘πŸ»β€πŸ’» Repository for my saving my leetcode solutions [JAVA/PYTHON3]

Notifications You must be signed in to change notification settings

jagrit007/lc-prac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Solved Problems πŸ§‘πŸ»β€πŸ’»

S.no. Title Link SolutionApproachUsed DataStructuresUsed Level(Hard/Med/Easy)
1 Two Sum two-sum.py Use hashmap for O(n) efficiency Hash Map Easy
2 Best Time to Buy and Sell Stock best-time-to-buy-and-sell-stock.py Track min price and max profit Array Easy
3 Valid Palindrome valid-palindrome.py Filter alphanumeric and check palindrome String Easy
4 Longest Consecutive Sequence longest-consecutive-sequence.py Set to find sequences, then iterate Set Hard
5 Minimum Garden Perimeter to Collect Enough Apples minimum-garden-perimeter-to-collect-enough-apples.java Increment perimeter until apples met Math Medium
6 Single Number single-number.py Bitwise XOR to isolate single number Bit Manipulation Easy
7 Longest Common Prefix longest-common-prefix.py Sort and compare first and last strings Array Easy
8 Two Sum II - Input Array Is Sorted two-sum-ii-input-array-is-sorted.py Two pointers from ends to middle Array Medium
9 Letter Combinations of a Phone Number letter-combinations-of-a-phone-number.java Recursive combination generation String, Recursion Medium
10 Factorial Trailing Zeroes factorial-trailing-zeroes.py Count multiples of 5 in n! Math Easy
11 Remove Nth Node From End of List remove-nth-node-from-end-of-list.java Two pointers with n gap Linked List Medium
12 Count Primes count-primes.java Sieve of Eratosthenes Array Easy
13 Kth Largest Element in an Array kth-largest-element-in-an-array.py Min-heap for top K elements Heap Medium
14 Contains Duplicate contains-duplicate.py Hashset to track duplicates Hash Set Easy
15 Palindrome Linked List palindrome-linked-list.java Convert to list and check palindrome Linked List Easy
16 Product of Array Except Self product-of-array-except-self.py Left and right product lists Array Medium
17 Valid Anagram valid-anagram.py Check if t is permutation of s Hash Map Easy
18 Missing Number missing-number.py Sort and find missing number Math Easy
19 Encode and Decode Strings encode-and-decode-strings.py Length header for each string String Medium
20 Move Zeroes move-zeroes.py Two pointers to swap non-zero elements Array Easy
21 Bulb Switcher bulb-switcher.java Math.sqrt to find the switch count Math Medium
22 Top K Frequent Elements top-k-frequent-elements.py Heap to find top K frequent elements Heap Medium
23 Valid Sudoku valid-sudoku.py Sets to check row, column, and box validity Hash Set Medium
24 Sudoku Solver sudoku-solver.java Backtracking to solve the puzzle Backtracking Hard
25 Fizz Buzz fizz-buzz.py Iterate and check divisibility by 3 and 5 Array Easy
26 Trapping Rain Water trapping-rain-water.py Two pointers to calculate trapped water Array Hard
27 Group Anagrams group-anagrams.py Categorize by sorted string Hash Map Medium
28 Pow(x, n) powx-n.py Direct computation Math Medium
29 N-Queens n-queens.java Backtracking to place queens Backtracking Hard
30 Contiguous Array contiguous-array.py Hash map to track count balance Hash Map Medium
31 Permutation in String permutation-in-string.py Sliding window with character count Hash Map Medium
32 Reverse Integer reverse-integer.py Reverse digits of the integer Math Easy
33 Binary Search binary-search.py Binary search algorithm Array Easy
34 Palindrome Number palindrome-number.py Check if integer is palindrome without converting Math Easy
35 Linked List Cycle linked-list-cycle.java Fast and slow pointers to detect cycle Linked List Easy
36 Min Stack min-stack.java Design a stack that supports min in O(1) time Stack Easy
37 Valid Parentheses valid-parentheses.java Stack to check for balanced parentheses Stack Easy
38 Merge Two Sorted Lists merge-two-sorted-lists.java Merge two linked lists iteratively Linked List Easy
39 Merge k Sorted Lists merge-k-sorted-lists.java Re-use mergeTwoLists code and DAQ approach Linked List, Heap Hard
40 Assign Cookies assign-cookies.py Greedy to satisfy the most children Array, Greedy Easy
41 Permutations permutations.py Backtracking Array, Backtracking Medium
42 Image Smoother image-smoother.py Iterate and calculate average Array Easy
43 Combination Sum combination-sum.py Backtracking to find unique combinations Array, Backtracking Medium
44 Word Search word-search.py DFS to search words in a grid Array, DFS Medium
45 Sort the Students by Their Kth Score sort-the-students-by-their-kth-score.py Sorting based on criteria Array Medium
46 Subsets subsets.py Backtracking to generate all subsets Array, Backtracking Medium
47 Custom Sort String custom-sort-string.py Custom sorting logic String, Hash Map Medium
48 Koko Eating Bananas koko-eating-bananas.py Binary search to find the minimum speed Array, Binary Search Medium
49 Palindrome Partitioning palindrome-partitioning.py Backtracking to find all possible palindrome partitioning Array, Backtracking Medium
50 Evaluate Reverse Polish Notation evaluate-reverse-polish-notation.py Evaluate the value of an arithmetic expression in Reverse Polish Notation Stack Medium
51 Generate Parentheses generate-parentheses.py Backtracking to generate all combinations of well-formed parentheses String, Backtracking Medium
52 Daily Temperatures daily-temperatures.py Stack to find the next greater temperature Array, Stack Medium
53 Car Fleet car-fleet.py Sorting and stack to calculate car fleets Array, Sorting Medium
54 Maximum 69 Number maximum-69-number.py Greedy to maximize the number Math Easy
55 Number of Employees Who Met the Target number-of-employees-who-met-the-target.py Analyzing employee performance data Array Medium
56 Longest Substring Without Repeating Characters longest-substring-without-repeating-characters.py Sliding window to find unique substring String, Hash Map Medium
57 Split the Array split-the-array.py Divide array into segments Array, Greedy Medium
58 Longest Repeating Character Replacement longest-repeating-character-replacement.py Sliding window with character count String, Hash Map Medium
59 Minimum Window Substring minimum-window-substring.py Sliding window to cover all characters String, Hash Map Hard
60 Longest Common Subsequence longest-common-subsequence.py Dynamic programming to find subsequence Array, DP Medium
61 Climbing Stairs climbing-stairs.py Dynamic programming for step combinations Math, DP Easy
62 Word Break word-break.py DP to check word segmentation possibilities String, DP Medium
63 Longest Increasing Subsequence longest-increasing-subsequence.py DP for increasing subsequences Array, DP Medium
64 Number of 1 Bits number-of-1-bits.py Bit manipulation to count set bits Bit Manipulation Easy
65 Largest Rectangle in Histogram largest-rectangle-in-histogram.py Stack to find largest rectangle area Array, Stack Hard
66 Sliding Window Maximum sliding-window-maximum.py Deque for maximum in sliding window Array, Deque Hard
67 Length of Last Word length-of-last-word.py Iteration and String Manipulation String Easy

View on Google Sheets

I am aware that links are broken as of now [FIXED] βœ…

About

πŸ§‘πŸ»β€πŸ’» Repository for my saving my leetcode solutions [JAVA/PYTHON3]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published