- Array
Two SumBest Time to Buy and Sell StockMajority ElementContains Duplicate- Meeting Rooms
Move Zeroes- Squares of a Sorted Array
Insert Interval- 3Sum
Product of Array Except Self- Combination Sum
- Merge Intervals
- Sort Colors
- Container With Most Water
- Gas Station
- Longest Consecutive Sequence
- Rotate Array
- Contiguous Array
- Subarray Sum Equals K
- Meeting Rooms II
- 3Sum Closest
- Non-overlapping Intervals
- Employee Free Time
- Sliding Window Maximum
- Stack
Valid Parentheses- Implement Queue using Stacks
- Min Stack
- Backspace String Compare
- Evaluate Reverse Polish Notation
- Daily Temperatures
- Decode String
- Asteroid Collision
- Basic Calculator II
- Trapping Rain Water
- Basic Calculator
- Largest Rectangle in Histogram
- Maximum Frequency Stack
- Longest Valid Parentheses
- Linked List
- String
Valid PalindromeValid Anagram- Longest Palindrome
- Longest Common Prefix
- Longest Substring Without Repeating Characters
- String to Integer (atoi)
- Longest Palindromic Substring
- Find All Anagrams in a String
- Group Anagrams
- Longest Repeating Character Replacement
- Largest Number
- Encode and Decode Strings
- Minimum Window Substring
- Palindrome Pairs
- Binary Tree
- Invert Binary Tree
- Balanced Binary Tree
- Diameter of Binary Tree
- Maximum Depth of Binary Tree
- Same Tree
- Symmetric Tree
- Subtree of Another Tree
- Binary Tree Level Order Traversal
- Lowest Common Ancestor of a Binary Tree
- Binary Tree Right Side View
- Construct Binary Tree from Preorder and Inorder Traversal
- Path Sum II
- Maximum Width of Binary Tree
- Binary Tree Zigzag Level Order Traversal
- Path Sum III
- All Nodes Distance K in Binary Tree
- Serialize and Deserialize Binary Tree
- Binary Tree Maximum Path Sum
- Binary Search
- Graph
- Flood Fill
- 01 Matrix
- Clone Graph
- Course Schedule
- Number of Islands
- Rotting Oranges
- Accounts Merge
- Word Search
- Minimum Height Trees
- Pacific Atlantic Water Flow
- Shortest Path to Get Food
- Graph Valid Tree
- Course Schedule II
- Number of Connected Components in an Undirected Graph
- Minimum Knight Moves
- Cheapest Flights Within K Stops
- Word Ladder
- Longest Increasing Path in a Matrix
- Word Search II
- Alien Dictionary
- Bus Routes
- Dynamic Programming
- Binary Search Tree
- Hash Table
- Binary
- Math
- Heap
- Trie
- Recursion
- Matrix
- Queue
-
Leetcode
Initialize hashmap with element as key and index as value. Iterate through array checking if target number minus current element in hashmap. If yes, return indexes of both elements from hashmap -
Best Time to Buy and Sell Stock
Leetcode
Use sliding window to keep track of start index and end = start + 1 index. Keep track of max and current profit starting at 0. If end - start less than 0, update start to end and end to start + 1. Else, if end - start > max profit, update max profit and move end to next element. -
Leetcode
Use hashmap to keep count of how many times an element appears in array, then iterate over hashmap and return element with a count > ceiling(n/2)
More optimal solution would be using the Boyer-Moore algorithm. Initialize count to 0 and potential candidate to first element in array. Then increment or decrement count by iterating through the array and seeing if potential candidate is present or not. Once count reaches 0, change potential candidate to be present element. Return potential candidate left. -
Leetcode
Use hashmap to keep count of how many times an element appears while iterating through the array. If current element already in hashmap, return true. If loop concludes, return false as no duplicate elements. -
Leetcode
Premium leetcode required, didn't solve -
Leetcode
Use 2 pointers starting from indices 0 and 1. 3 scenarios possible: both pointers = 0, move right one until find nonzero then swap; left pointer at 0 and right at nonzero, swap. left pointer at nonzero and right at zero, move both pointers 1 down array. -
Leetcode
Yet to solve -
Leetcode
Create an array to store result. Iterate through intervals and check for 3 scenarios: if last num in new interval less than first num in curr element, append new interval and return result + rest of intervals; if first num in new interval greater than last num in curr element, append curr element; if none of the above, there is overlap thus update new interval numbers and continue iterating. at the end, append new interval and return res (if new interval was inserted, result would have been returned in first scenario). -
Leetcode
Yet to solve -
Leetcode
Initialize array to store results. Initialize prefix variable = 1. Start iterating through nums array and store the prefix in results array, then multiply prefix by current element before moving to next element. That way each index in the result array contains all numbers that came before that index in nums array multiplied. Repeat the same backwards with postfix that stores the suffix of numbers that came after the element. Return results array. -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Intialize hashmap matching all types of open brackets as keys to closing brackets as values. Then intialize stack adt using array, pushing opening brackets and only popping last one when you encounter a matching closing bracket. If array is empty, then all matching brackets are positioned in valid locations. -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Evaluate Reverse Polish Notation
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Largest Rectangle in Histogram
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Initialize linkedlist called new and let a variable called prev point to it. Start while loop that checks if both lists 1 and 2 are not empty. 2 scenarios: val of curr node in list 1 less than that of 2 so let the next node of new be curr node of l1, and move to next node of l1; else, do the same for l2. Then set prev to next node of new and repeat. At end of loop, let prev.next equal to the non-empty list and return new.next as new.val is 0 and we started by changing new.next. -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Remove Nth Node From End of List
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Initalize start and end pointers on the array moving in opposite directions. If start and end pointing to alnum characters, check if they're equal (apply lowercase method) and return false if not else move pointers. If a pointer not pointing to alnum char, move the pointer. If loop finishes running, return true. -
Leetcode
Initialize hash map to keep track of count of letters in first string, repeat for second string. Then iterate through both hash maps checking if a char is present in one and not the other or if count of characters in one not equal to count in other and return false. if all loops finish running, return true. -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Longest Substring Without Repeating Characters
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Longest Repeating Character Replacement
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Binary Tree Level Order Traversal
Leetcode
Yet to solve -
Lowest Common Ancestor of a Binary Tree
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Construct Binary Tree from Preorder and Inorder Traversal
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Binary Tree Zigzag Level Order Traversal
Leetcode
Yet to solve -
Leetcode
Yet to solve -
All Nodes Distance K in Binary Tree
Leetcode
Yet to solve -
Serialize and Deserialize Binary Tree
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Search in Rotated Sorted Array
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Find Minimum in Rotated Sorted Array
Leetcode
Yet to solve -
Maximum Profit in Job Scheduling
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Number of Connected Components in an Undirected Graph
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Cheapest Flights Within K Stops
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Longest Increasing Path in a Matrix
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Longest Increasing Subsequence
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Lowest Common Ancestor of a Binary Search Tree
Leetcode
Yet to solve -
Convert Sorted Array to Binary Search Tree
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Kth Largest Element in an Array
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Smallest Range Covering Elements from K Lists
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Design Add and Search Words Data Structure
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Letter Combinations of a Phone Number
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
-
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve -
Leetcode
Yet to solve
- Design Hit Counter
Leetcode
Yet to solve