LeetCode Problems

Table of content

Array/String

Simple Pointers

Remove Duplicates from Sorted Array I Remove Duplicates from Sorted Array II Remove Element Move Zeroes Duplicate Zeros Candy Trapping Rain Water Product of Array Except Self Minimum Size Subarray Sum Summary Ranges 🔒Missing Ranges Merge Intervals Insert Interval Interval List Intersections Partition Labels Find And Replace in String My Calendar II 🔒One Edit Distance Merge Sorted Array Is Subsequence Backspace String Compare Repeated String Match Long Pressed Name Container With Most Water Reverse Vowels of a String Valid Palindrome 🔒Shortest Word Distance 🔒Shortest Word Distance II 🔒Shortest Word Distance III Intersection of Two Arrays Intersection of Two Arrays II Two Sum II Sum of Square Numbers 🔒Two Sum III 3Sum 4Sum 3Sum Closest 🔒Wiggle Sort Wiggle subsequence Longest Common Prefix Next permutation 🔒Sentence Screen Fitting Unique Email Addresses Camelcase Matching Push Dominoes Repeated Substring Pattern Buddy Strings Two Furthest Houses With Different Colors Minimum Time Difference

Binary Search

To avoid index overflow error
int mid = left + (right-left) / 2;
Search Insert Position Median of Two Sorted Arrays Find Minimum in Rotated Sorted Array I Find Minimum in Rotated Sorted Array II Find First and Last Position of Element in Sorted Array Guess Number Higher or Lower First Bad Version Count Negative Numbers in a Sorted Matrix Search in Rotated Array I Search in Rotated Array II Single Element in a Sorted Array Longest Increasing Subsequence Count of Smaller Numbers After Self Russian Doll Envelopes H-Index I H-Index II 1011.Capacity To Ship Packages Within D Days

Longest Increasing Subsequence

368.Largest Divisible Subset 646.Maximum Length of Pair Chain 1626.Best Team With No Conflicts 1691.Maximum Height by Stacking Cuboids

HashMap

Valid Anagram Group Shifted Strings Palindrome Pairs Line Reflection Isomorphic Strings 387.First Unique Character in a String

[IMP] Sum subarray related problems | hashmap prefix-sum algo

Two Sum 532.K-diff Pairs in an Array Maximum Size Subarray Sum Equals k 560.Subarray Sum Equals K 1171.Remove Zero Sum Consecutive Nodes from Linked List [solution works for most of the cases] 525.Contiguous Array

HashMap Tracking variable size sliding window

Longest Substring Without Repeating Characters --use hashset-- Longest Substring that contains k unique characters --use hashmap-- Substring with Concatenation of All Words Minimum Window Substring Longest Substring with At Least K Repeating Characters Permutation in String [same as find all anagrams]