Medium
Solutions and thought process for medium difficulty Leetcode problems.
146. LRU Cache
Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.
56. Merge Intervals
Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.
200. Number of Islands
Given an m x n 2D binary grid grid which represents a map of '1' s (land) and '0' s (water), return the number of islands.
567. Permutation in String
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.
424. Longest Repeating Character Replacement
You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times.
3. Longest Substring Without Repeating Characters
Given a string s, find the length of the longest substring without duplicate characters.
875. Koko Eating Bananas
Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours.
155. Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
128. Longest Consecutive Sequence
Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.
49. Group Anagrams
Given an array of strings strs, group the anagrams together. You can return the answer in any order.