Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jagrit007/lc-prac
🧑🏻💻 Repository for my saving my leetcode solutions [JAVA/PYTHON3]
https://github.com/jagrit007/lc-prac
leetcode leetcode-python leetcode-solutions
Last synced: about 2 months ago
JSON representation
🧑🏻💻 Repository for my saving my leetcode solutions [JAVA/PYTHON3]
- Host: GitHub
- URL: https://github.com/jagrit007/lc-prac
- Owner: jagrit007
- Created: 2024-01-24T14:17:41.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-07-15T16:57:19.000Z (6 months ago)
- Last Synced: 2024-07-15T20:23:41.267Z (6 months ago)
- Topics: leetcode, leetcode-python, leetcode-solutions
- Language: Python
- Homepage:
- Size: 225 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Solved Problems 🧑🏻💻
| S.no. | Title | Link | SolutionApproachUsed | DataStructuresUsed | Level(Hard/Med/Easy) |
| ----- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------ | -------------------- |
| 1 | Two Sum | [two-sum.py](https://github.com/jagrit007/lc-prac/tree/main/1-two-sum) | 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](https://github.com/jagrit007/lc-prac/tree/main/121-best-time-to-buy-and-sell-stock) | Track min price and max profit | Array | Easy |
| 3 | Valid Palindrome | [valid-palindrome.py](https://github.com/jagrit007/lc-prac/tree/main/125-valid-palindrome) | Filter alphanumeric and check palindrome | String | Easy |
| 4 | Longest Consecutive Sequence | [longest-consecutive-sequence.py](https://github.com/jagrit007/lc-prac/tree/main/128-longest-consecutive-sequence) | Set to find sequences, then iterate | Set | Hard |
| 5 | Minimum Garden Perimeter to Collect Enough Apples | [minimum-garden-perimeter-to-collect-enough-apples.java](https://github.com/jagrit007/lc-prac/tree/main/1295-minimum-garden-perimeter-to-collect-enough-apples) | Increment perimeter until apples met | Math | Medium |
| 6 | Single Number | [single-number.py](https://github.com/jagrit007/lc-prac/tree/main/136-single-number) | Bitwise XOR to isolate single number | Bit Manipulation | Easy |
| 7 | Longest Common Prefix | [longest-common-prefix.py](https://github.com/jagrit007/lc-prac/tree/main/14-longest-common-prefix) | 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](https://github.com/jagrit007/lc-prac/tree/main/167-two-sum-ii-input-array-is-sorted) | Two pointers from ends to middle | Array | Medium |
| 9 | Letter Combinations of a Phone Number | [letter-combinations-of-a-phone-number.java](https://github.com/jagrit007/lc-prac/tree/main/17-letter-combinations-of-a-phone-number) | Recursive combination generation | String, Recursion | Medium |
| 10 | Factorial Trailing Zeroes | [factorial-trailing-zeroes.py](https://github.com/jagrit007/lc-prac/tree/main/172-factorial-trailing-zeroes) | Count multiples of 5 in n! | Math | Easy |
| 11 | Remove Nth Node From End of List | [remove-nth-node-from-end-of-list.java](https://github.com/jagrit007/lc-prac/tree/main/19-remove-nth-node-from-end-of-list) | Two pointers with n gap | Linked List | Medium |
| 12 | Count Primes | [count-primes.java](https://github.com/jagrit007/lc-prac/tree/main/204-count-primes) | Sieve of Eratosthenes | Array | Easy |
| 13 | Kth Largest Element in an Array | [kth-largest-element-in-an-array.py](https://github.com/jagrit007/lc-prac/tree/main/215-kth-largest-element-in-an-array) | Min-heap for top K elements | Heap | Medium |
| 14 | Contains Duplicate | [contains-duplicate.py](https://github.com/jagrit007/lc-prac/tree/main/217-contains-duplicate) | Hashset to track duplicates | Hash Set | Easy |
| 15 | Palindrome Linked List | [palindrome-linked-list.java](https://github.com/jagrit007/lc-prac/tree/main/234-palindrome-linked-list) | Convert to list and check palindrome | Linked List | Easy |
| 16 | Product of Array Except Self | [product-of-array-except-self.py](https://github.com/jagrit007/lc-prac/tree/main/238-product-of-array-except-self) | Left and right product lists | Array | Medium |
| 17 | Valid Anagram | [valid-anagram.py](https://github.com/jagrit007/lc-prac/tree/main/242-valid-anagram) | Check if t is permutation of s | Hash Map | Easy |
| 18 | Missing Number | [missing-number.py](https://github.com/jagrit007/lc-prac/tree/main/268-missing-number) | Sort and find missing number | Math | Easy |
| 19 | Encode and Decode Strings | [encode-and-decode-strings.py](https://github.com/jagrit007/lc-prac/tree/main/271-encode-and-decode-strings) | Length header for each string | String | Medium |
| 20 | Move Zeroes | [move-zeroes.py](https://github.com/jagrit007/lc-prac/tree/main/283-move-zeroes) | Two pointers to swap non-zero elements | Array | Easy |
| 21 | Bulb Switcher | [bulb-switcher.java](https://github.com/jagrit007/lc-prac/tree/main/319-bulb-switcher) | Math.sqrt to find the switch count | Math | Medium |
| 22 | Top K Frequent Elements | [top-k-frequent-elements.py](https://github.com/jagrit007/lc-prac/tree/main/347-top-k-frequent-elements) | Heap to find top K frequent elements | Heap | Medium |
| 23 | Valid Sudoku | [valid-sudoku.py](https://github.com/jagrit007/lc-prac/tree/main/36-valid-sudoku) | Sets to check row, column, and box validity | Hash Set | Medium |
| 24 | Sudoku Solver | [sudoku-solver.java](https://github.com/jagrit007/lc-prac/tree/main/37-sudoku-solver) | Backtracking to solve the puzzle | Backtracking | Hard |
| 25 | Fizz Buzz | [fizz-buzz.py](https://github.com/jagrit007/lc-prac/tree/main/412-fizz-buzz) | Iterate and check divisibility by 3 and 5 | Array | Easy |
| 26 | Trapping Rain Water | [trapping-rain-water.py](https://github.com/jagrit007/lc-prac/tree/main/42-trapping-rain-water) | Two pointers to calculate trapped water | Array | Hard |
| 27 | Group Anagrams | [group-anagrams.py](https://github.com/jagrit007/lc-prac/tree/main/49-group-anagrams) | Categorize by sorted string | Hash Map | Medium |
| 28 | Pow(x, n) | [powx-n.py](https://github.com/jagrit007/lc-prac/tree/main/50-powx-n) | Direct computation | Math | Medium |
| 29 | N-Queens | [n-queens.java](https://github.com/jagrit007/lc-prac/tree/main/51-n-queens) | Backtracking to place queens | Backtracking | Hard |
| 30 | Contiguous Array | [contiguous-array.py](https://github.com/jagrit007/lc-prac/tree/main/525-contiguous-array) | Hash map to track count balance | Hash Map | Medium |
| 31 | Permutation in String | [permutation-in-string.py](https://github.com/jagrit007/lc-prac/tree/main/567-permutation-in-string) | Sliding window with character count | Hash Map | Medium |
| 32 | Reverse Integer | [reverse-integer.py](https://github.com/jagrit007/lc-prac/tree/main/7-reverse-integer) | Reverse digits of the integer | Math | Easy |
| 33 | Binary Search | [binary-search.py](https://github.com/jagrit007/lc-prac/tree/main/792-binary-search) | Binary search algorithm | Array | Easy |
| 34 | Palindrome Number | [palindrome-number.py](https://github.com/jagrit007/lc-prac/tree/main/9-palindrome-number) | Check if integer is palindrome without converting | Math | Easy |
| 35 | Linked List Cycle | [linked-list-cycle.java](https://github.com/jagrit007/lc-prac/tree/main/141-linked-list-cycle) | Fast and slow pointers to detect cycle | Linked List | Easy |
| 36 | Min Stack | [min-stack.java](https://github.com/jagrit007/lc-prac/blob/main/155-min-stack/min-stack.java) | Design a stack that supports min in O(1) time | Stack | Easy |
| 37 | Valid Parentheses | [valid-parentheses.java](https://github.com/jagrit007/lc-prac/blob/main/20-valid-parentheses/valid-parentheses.java) | Stack to check for balanced parentheses | Stack | Easy |
| 38 | Merge Two Sorted Lists | [merge-two-sorted-lists.java](https://github.com/jagrit007/lc-prac/blob/main/21-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](https://github.com/jagrit007/lc-prac/blob/main/23-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](https://github.com/jagrit007/lc-prac/blob/main/455-assign-cookies/assign-cookies.py) | Greedy to satisfy the most children | Array, Greedy | Easy |
| 41 | Permutations | [permutations.py](https://github.com/jagrit007/lc-prac/blob/main/46-permutations/permutations.py) | Backtracking | Array, Backtracking | Medium |
| 42 | Image Smoother | [image-smoother.py](https://github.com/jagrit007/lc-prac/blob/main/661-image-smoother/image-smoother.py) | Iterate and calculate average | Array | Easy |
| 43 | Combination Sum | [combination-sum.py](https://github.com/jagrit007/lc-prac/blob/main/39-combination-sum/combination-sum.py) | Backtracking to find unique combinations | Array, Backtracking | Medium |
| 44 | Word Search | [word-search.py](https://github.com/jagrit007/lc-prac/blob/main/79-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](https://github.com/jagrit007/lc-prac/blob/main/2631-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](https://github.com/jagrit007/lc-prac/blob/main/78-subsets/subsets.py) | Backtracking to generate all subsets | Array, Backtracking | Medium |
| 47 | Custom Sort String | [custom-sort-string.py](https://github.com/jagrit007/lc-prac/blob/main/807-custom-sort-string/custom-sort-string.py) | Custom sorting logic | String, Hash Map | Medium |
| 48 | Koko Eating Bananas | [koko-eating-bananas.py](https://github.com/jagrit007/lc-prac/blob/main/907-koko-eating-bananas/koko-eating-bananas.py) | Binary search to find the minimum speed | Array, Binary Search | Medium |
| 49 | Palindrome Partitioning | [palindrome-partitioning.py](https://github.com/jagrit007/lc-prac/blob/main/131-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](https://github.com/jagrit007/lc-prac/blob/main/150-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](https://github.com/jagrit007/lc-prac/blob/main/22-generate-parentheses/generate-parentheses.py) | Backtracking to generate all combinations of well-formed parentheses | String, Backtracking | Medium |
| 52 | Daily Temperatures | [daily-temperatures.py](https://github.com/jagrit007/lc-prac/blob/main/739-daily-temperatures/daily-temperatures.py) | Stack to find the next greater temperature | Array, Stack | Medium |
| 53 | Car Fleet | [car-fleet.py](https://github.com/jagrit007/lc-prac/blob/main/883-car-fleet/car-fleet.py) | Sorting and stack to calculate car fleets | Array, Sorting | Medium |
| 54 | Maximum 69 Number | [maximum-69-number.py](https://github.com/jagrit007/lc-prac/blob/main/1448-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](https://github.com/jagrit007/lc-prac/blob/main/2876-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](https://github.com/jagrit007/lc-prac/blob/main/3-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](https://github.com/jagrit007/lc-prac/blob/main/3324-split-the-array/split-the-array.py) | Divide array into segments | Array, Greedy | Medium |
| 58 | Longest Repeating Character Replacement | [longest-repeating-character-replacement.py](https://github.com/jagrit007/lc-prac/blob/main/424-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](https://github.com/jagrit007/lc-prac/blob/main/76-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](https://github.com/jagrit007/lc-prac/blob/main/1250-longest-common-subsequence/longest-common-subsequence.py) | Dynamic programming to find subsequence | Array, DP | Medium |
| 61 | Climbing Stairs | [climbing-stairs.py](https://github.com/jagrit007/lc-prac/blob/main/70-climbing-stairs/climbing-stairs.py) | Dynamic programming for step combinations | Math, DP | Easy |
| 62 | Word Break | [word-break.py](https://github.com/jagrit007/lc-prac/blob/main/139-word-break/word-break.py) | DP to check word segmentation possibilities | String, DP | Medium |
| 63 | Longest Increasing Subsequence | [longest-increasing-subsequence.py](https://github.com/jagrit007/lc-prac/blob/main/300-longest-increasing-subsequence/longest-increasing-subsequence.py) | DP for increasing subsequences | Array, DP | Medium |
| 64 | Number of 1 Bits | [number-of-1-bits.py](https://github.com/jagrit007/lc-prac/blob/main/191-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](https://github.com/jagrit007/lc-prac/blob/main/84-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](https://github.com/jagrit007/lc-prac/blob/main/239-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](https://github.com/jagrit007/lc-prac/blob/main/58-length-of-last-word/length-of-last-word.py) | Iteration and String Manipulation | String | Easy |
---
[**View on Google Sheets**](https://bit.ly/j4grit-lc)~~*I am aware that links are broken as of now*~~ [FIXED] ✅