# 116+ Coding Interview Problems with Detailed Solutions

## Motivation

I am building a database of most frequently appeared coding interview problems that I think are the most valuable and productive to spend time on. For each one, I am including my thoughts of process on how to approach and solve it, adding well-documented solutions with test cases, time and space complexity analysis. My goal is to help you get good algorithms and data structures so that you can prepare better for your next coding interviews.

These resources that I am looking at are:

- Interview Cake
- LeetCode
- Cracking the Coding Interviews
- Grokking the Coding Interview: Patterns for Coding Questions
- Elements of Programming Interviews

If you’re interested in getting updates for this, feel free to join my mailing list here →

## Table of Contents

**Interview Cake**- Array and string manipulation
- Hashing and hash tables
- Greedy algorithms
- Sorting, searching, and logarithms
- Trees and graphs
- Dynamic programming and recursion
- Queues and stacks
- Linked lists
- Bit manipulation

**LeetCode**- Array/String
- Math
- Linked list
- Binary tree
- Bit manipulation
- Misc
- Stack
- Dynamic programming

**Cracking the Coding Interviews**- Bit manipulation

**Grokking the Coding Interview: Patterns for Coding Questions**- Sliding Window
- Average of any contiguous subarray of size k
- Maximum sum of any contiguous subarray of size k
- Smallest subarray with a given sum
- Longest substring with k distinct characters
- Fruits into baskets
- Longest substring without repeating characters
- Longest substring after k replacements
- Longest substring after ones replacements
- Permutation in string
- String anagrams

- Two pointers
- Fast and slow pointers
- Merge intervals
- Cyclic sort
- In-place reversal of a linked list
- Tree breath first search
- Tree depth first search
- Two Heaps
- Subsets

- Sliding Window
**Grokking Dynamic Programming Patterns**- Knapsack
- Fibonacci numbers

**Practical Algorithms and Data Structures****Elements of Programming Interviews****Lab (to experiment with different ideas)**- Data structures
- Tree
- Priority Queue:
*TODO* - Bloom filter:
*TODO* - LRU cache

- Sorting
- Bubble sort
- Selection sort
- Insertion sort
- Merge Sort
- Quicksort
- Heapsort
- Counting Sort
- Radix Sort:
*TODO*

- Data structures

## Developing

Count the number of questions:

```
make count
```

Clean up, lint source files, run tests and be ready for a push:

```
make ready
```

Test only:

```
make test
```

Test and report:

```
make cover
```

Test verbose:

```
make test-verbose
```

Lint:

```
make lint
```

Clean up:

```
make clean
```

For more information:

```
make help
```