Complete-Preparation

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

View the Project on GitHub

Leetcode Problem 500-599


501. Find Mode in Binary Search Tree 🌟

Hash map with DFS

Iterative DFS

Without extra space(without Hashmap)

Morris Traversal

Coming Soon …

TODO: solve using morris traversal.


515. Find Largest Value in Each Tree Row 🌟🌟

This question is in continuation with A general approach to level order traversal questions series.

Previous Questions

  1. Binary tree level order traversal
  2. Binary tree level order traversal - II
  3. Binary tree zig-zag level order traversal
  4. Average of levels
  5. Binary tree right side view

Recursive Solution

Iterative solution


518. Coin Change 2 🌟🌟

Recursive Solution (TLE)

Memoization (AC)

Tabulation (AC)


523. Continuous Subarray Sum 🌟🌟

Brute force

Prefix sum with hash map


525. Contiguous Array 🌟🌟

Brute Force (TLE)

hashmap (AC)

READ MORE


532. K-diff Pairs in an Array 🌟🌟

Brute force

with hashmap


540. Single Element in a Sorted Array 🌟🌟

Brute force

Hashmap

Bit Manipulation(XOR)



542. 01 Matrix 🌟🌟

BFS solution

Complexity:

DP Solution

Complexity:


547. Number of Provinces 🌟🌟


551. Student Attendance Record I 🌟

Iterative Solution

Using Builtin Functions

Recursive Solution

557. Reverse Words in a String III 🌟

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


560. Subarray Sum Equals K 🌟🌟

Brute force (TLE)

prefix sum (TLE)

Running sum (TLE)

Using hashmap (AC)


566. Reshape the Matrix 🌟

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

O(N*M) Time and O(N*M) Space (Row-First Approach

O(N*M) Time and O(N*M) Space (Column-First Approach)

soon…


567. Permutation in String 🌟🌟

O(N) Time and O(1) Space


576. Out of Boundary Paths 🌟🌟

Recursion (TLE)

Memorization (AC)

Tabulation (Bottom-Up) (AC)