This repository contains my solutions to LeetCode problems, solved in JavaScript/TypeScript.
The goal is to practice problem-solving, algorithms, and data structures in preparation for technical interviews.
Each solution is stored in a separate file, named by problem title.
/easy two-sums.ts contains-duplicate.ts best-time-to-buy-and-sell-stock.ts valid-parentheses.ts move-zeroes.ts valid-palindrome.ts valid-anagram.ts climbing-stairs.ts fibonacci-number.ts binary-search.ts search-insert-position.ts implement-queue-using-stacks.ts middle-of-the-linked-list.ts linked-list-cycle.ts reverse-linked-list.ts merge-two-sorted-lists.ts maximum-depth-of-binary-tree.ts same-tree.ts invert-binary-tree.ts symmetric-tree.ts average-of-levels-in-binary-tree.ts search-in-a-binary-search-tree.ts minimum-absolute-difference-in-bst.ts count-complete-tree-nodes.ts sum-of-all-subset-xor-totals.js min-cost-climbing-stairs.ts assign-cookies.ts lemonade-change.ts maximum-product-of-two-elements-in-an-array.ts kth-largest-element-in-a-stream.ts is-subsequence.ts pascals-triangle.ts n-th-tribonacci-number.ts design-parking-system.ts design-hashset.ts design-hashmap.ts design-an-ordered-stream.ts first-unique-character-in-a-string.ts intersection-of-two-arrays-ii.ts excel-sheet-column-title.ts excel-sheet-column-number.ts isomorphic-strings.ts
/medium maximum-subarray.ts two-sums-ii.ts group-anagrams.ts find-first-and-last-position-of-element-in-sorted-array.ts search-in-rotated-sorted-array.ts min-stack.ts daily-temperatures.ts rotting-oranges.ts binary-tree-level-order-traversal.ts binary-tree-right-side-view.ts validate-binary-search-tree.ts lowest-common-ancestor-of-a-binary-search-tree.ts number-of-islands.ts clone-graph.ts graph-valid-tree.js course-schedule.ts minimum-knight-moves.ts subsets.ts permutations.js combination-sum.js combinations.ts combination-sum.ts best-time-to-buy-and-sell-stock-with-cooldown.ts decode-ways.ts climbing-stairs-ii.ts house-robber.ts coin-change.ts word-break.ts longest-common-subsequence.ts maximum-length-of-repeated-subarray.ts unique-paths.ts unique-paths-ii.ts minimum-path-sum.ts longest-palindromic-substring.ts non-overlapping-intervals.ts best-time-to-buy-and-sell-stock-ii.ts task-scheduler.ts meeting-rooms-ii.js maximum-number-of-eaten-apples.ts wiggle-subsequence.ts jump-game.ts jump-game-ii.ts two-city-scheduling.ts longest-increasing-subsequence.ts maximum-product-subarray.ts lru-cache.ts memoize.ts number-of-dice-rolls-with-target-sum.ts time-based-key-value-store.ts design-twitter.ts kth-largest-element-in-an-array.ts insert-delete-getrandom-o1.ts top-k-frequent-elements.ts encode-and-decode-tinyurl.ts
/hard word-ladder.js sudoku-solver.ts
- Clone the repository
git clone https://github.com/ami619847/leetcode.git
- Install dependencies
npm install
- Two Sums - https://leetcode.com/problems/two-sum/description/
- Contains Duplicate - https://leetcode.com/problems/contains-duplicate/description/
- Best Time to Buy and Sell Stock - https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
- Valid Parentheses - https://leetcode.com/problems/valid-parentheses/description/
- Move Zeroes - https://leetcode.com/problems/move-zeroes/description/
- Maximum Subarray - https://leetcode.com/problems/maximum-subarray/description/
- Valid Palindrom - https://leetcode.com/problems/valid-palindrome/description/
- valid Anagram - https://leetcode.com/problems/valid-anagram/description/
- Two Sums II - Input Array Is Sorted - https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/
- Group Anagrams - https://leetcode.com/problems/group-anagrams/description/
- Climbing Stairs - https://leetcode.com/problems/climbing-stairs/description/
- Fibonacci Number - https://leetcode.com/problems/fibonacci-number/
- Binary Search - https://leetcode.com/problems/binary-search/description/
- Search Insert Position - https://leetcode.com/problems/search-insert-position/description/
- Find First and Last Position of Element in Sorted Array - https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/description/
- Search in Rotated Sorted Array - https://leetcode.com/problems/search-in-rotated-sorted-array/description
- Min Stack - https://leetcode.com/problems/min-stack/description/
- Daily Temperatures - https://leetcode.com/problems/daily-temperatures/description/
- Implement Queue Using Stacks - https://leetcode.com/problems/implement-queue-using-stacks/description/
- Rotting Oranges - https://leetcode.com/problems/rotting-oranges/description/
- Middle of the Linked List - https://leetcode.com/problems/middle-of-the-linked-list/description/
- Linked List Cycle - https://leetcode.com/problems/linked-list-cycle/description/
- Reverse Linked List - https://leetcode.com/problems/reverse-linked-list/description/
- Merge Two Sorted Lists - https://leetcode.com/problems/merge-two-sorted-lists/description/
- Maximum Depth of Binary Tree - https://leetcode.com/problems/maximum-depth-of-binary-tree/description/
- Same Tree - https://leetcode.com/problems/same-tree/description/
- Invert Binary Tree - https://leetcode.com/problems/invert-binary-tree/description/
- Symmetric Tree - https://leetcode.com/problems/symmetric-tree/description/
- Average of Levels in Binary Tree - https://leetcode.com/problems/average-of-levels-in-binary-tree/description
- Binary Tree Level Order Traversal - https://leetcode.com/problems/binary-tree-level-order-traversal/description/
- Binary Tree Right Side View - https://leetcode.com/problems/binary-tree-right-side-view/description
- Search in a Binary Search Tree - https://leetcode.com/problems/search-in-a-binary-search-tree/description/
- Validate BST - https://leetcode.com/problems/validate-binary-search-tree/description/
- Minimum Absolute Difference in bst/ - https://leetcode.com/problems/minimum-absolute-difference-in-bst/description/
- Lowest Common Ancestor of BST - https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/
- Count Complete Tree Nodes - https://leetcode.com/problems/count-complete-tree-nodes/description/
- Number of Islands - https://leetcode.com/problems/number-of-islands/description/
- Clone Graph - https://leetcode.com/problems/clone-graph/description/
- Graph Valid Tree - https://neetcode.io/problems/valid-tree
- Word Ladder - https://leetcode.com/problems/word-ladder/description/
- Course Schedule - https://leetcode.com/problems/course-schedule/description/
- Minimum Knight Moves - https://www.geeksforgeeks.org/problems/steps-by-knight5927/1/
- Sum of All Subset XOR Totals - https://leetcode.com/problems/sum-of-all-subset-xor-totals/description/
- Subsets - https://leetcode.com/problems/subsets/description/
- Permutations - https://leetcode.com/problems/permutations/description/
- Combination Sum - https://leetcode.com/problems/combination-sum/description/
- Sudoku Solver - https://leetcode.com/problems/sudoku-solver/description/
- Combinations - https://leetcode.com/problems/combinations/description/
- Combination Sum III - https://leetcode.com/problems/combination-sum-iii/description/
- Min Cost Climbing Stairs - https://leetcode.com/problems/min-cost-climbing-stairs/description/
- Best Time to Buy and Sell Stock with Cooldown - https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/description/
- Decode Ways - https://leetcode.com/problems/decode-ways/description/
- Climbing Stairs II - https://leetcode.com/problems/climbing-stairs-ii/description/
- House Robber - https://leetcode.com/problems/house-robber/description/
- Coin Change - https://leetcode.com/problems/coin-change/description/
- Word Break - https://leetcode.com/problems/word-break/description/
- Longest Common Subsequence - https://leetcode.com/problems/longest-common-subsequence/description/
- Maximum Length of Repeated Subarray - https://leetcode.com/problems/maximum-length-of-repeated-subarray/description/
- Unique Paths - https://leetcode.com/problems/unique-paths/description/
- Unique Paths II - https://leetcode.com/problems/unique-paths-ii/description/
- Minimum Path Sum - https://leetcode.com/problems/minimum-path-sum/description/
- Longest Palindromic Substring - https://leetcode.com/problems/longest-palindromic-substring/description/
- Assign Cookies - https://leetcode.com/problems/assign-cookies/description/
- Lemonade Change - https://leetcode.com/problems/lemonade-change/description/
- Non-overlapping Intervals - https://leetcode.com/problems/non-overlapping-intervals/description/
- maximum-product-of-two-elements-in-an-array - https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/description/
- Kth Largest Element in a Stream - https://leetcode.com/problems/kth-largest-element-in-a-stream/description/
- Best Time to Buy and Sell Stock II - https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/
- Task Scheduler - https://leetcode.com/problems/task-scheduler/description/
- Meeting Rooms II - https://neetcode.io/problems/meeting-schedule-ii?list=neetcode150
- Maximum Number of Eaten Apples - https://leetcode.com/problems/maximum-number-of-eaten-apples/description/
- Is Subsequence - https://leetcode.com/problems/is-subsequence/description
- Wiggle Subsequence - https://leetcode.com/problems/wiggle-subsequence/description/
- Jump Game - https://leetcode.com/problems/jump-game/description/
- Jump Game II - https://leetcode.com/problems/jump-game-ii/description/
- Two City Scheduling - https://leetcode.com/problems/two-city-scheduling/description/
- Pascals Triangle - https://leetcode.com/problems/pascals-triangle/description/
- Nth Tribonacci Number - https://leetcode.com/problems/n-th-tribonacci-number/description/
- Longest Increasing Subsequence - https://leetcode.com/problems/longest-increasing-subsequence/description/
- Maximum Product Subarray - https://leetcode.com/problems/maximum-product-subarray/description/
- LRU Cache - https://leetcode.com/problems/lru-cache/description/
- Memoize - https://leetcode.com/problems/memoize/description/
- Number of Dice Rolls with Target Sum - https://leetcode.com/problems/number-of-dice-rolls-with-target-sum/description/
- Design Parking System - https://leetcode.com/problems/design-parking-system/description/
- Design Hashset - https://leetcode.com/problems/design-hashset/description/
- Design Hashmap - https://leetcode.com/problems/design-hashmap/description/
- Design an Ordered Stream - https://leetcode.com/problems/design-an-ordered-stream/description/
- Time Based Key Value Store - https://leetcode.com/problems/time-based-key-value-store/description/
- Design Twitter - https://leetcode.com/problems/design-twitter/description/
- Kth Largest Element in an Array - https://leetcode.com/problems/kth-largest-element-in-an-array/description/
- First Unique Character in a String - https://leetcode.com/problems/first-unique-character-in-a-string/description/
- Intersection of Two Arrays II - https://leetcode.com/problems/intersection-of-two-arrays-ii/description/
- Insert Delete GetRandom O(1) - https://leetcode.com/problems/insert-delete-getrandom-o1/description
- Top K Frequent Elements - https://leetcode.com/problems/top-k-frequent-elements/description/
- Excel Sheet Column Title - https://leetcode.com/problems/excel-sheet-column-title/description/
- Excel Sheet Column Number - https://leetcode.com/problems/excel-sheet-column-number/description/
- Isomorphic Strings - https://leetcode.com/problems/isomorphic-strings/description/
- Encode and Decode TinyURL - https://leetcode.com/problems/encode-and-decode-tinyurl/description/