Complete-Preparation

πŸŽ‰ One-stop destination for all your technical interview Preparation πŸŽ‰

View the Project on GitHub

Leetcode Problem 300-399

304. Range Sum Query 2D - Immutable 🌟🌟

Brute force (TLE)

Row Prefix sum (AC)

Area Prefix sum (AC)


309. Best Time to Buy and Sell Stock with Cooldown 🌟🌟

Recursive Solution (TLE)

Memoization (AC)

Tabulation (AC)

Space optimized dp


310. Minimum Height Trees 🌟🌟


316. Remove Duplicate Letters 🌟🌟

NOTE: This question is same as 1081

Solution


322. Coin Change 🌟🌟

Recursive solution (TLE)

Memoization (Top-Down) (AC)

Tabulation (Bottom-Up) (AC)


329. Longest Increasing Path in a Matrix 🌟🌟🌟

DFS with memoization


338. Counting Bits 🌟🌟

STL

DP


342. Power of Four 🌟

General Solution for any power

Bitwise Solution


344. Reverse String 🌟

O(N) time and O(1) space, using stack

O(N) Time , recursive

O(N) Time two pointer solution


350. Intersection of Two Arrays II 🌟

O(N*M) Time and O(N) Space


382. Linked List Random Node 🌟🌟


383. Ransom Note 🌟

same as is_subsequence problem.

O(N) Time O(N)=O(26) constant space


387. First Unique Character in a String 🌟

O(N^2) Time and O(1) space

O(N) Time and O(N)=O(26) constant space


389. Find the Difference 🌟

Brute force

sorting

Hashing

Bit Manipulation


392. Is Subsequence 🌟

Recursive solution

Dynamic Programming