0% found this document useful (0 votes)
25 views

Leetcode Categories

The document discusses different types of common algorithms and data structures used for coding interviews including arrays, strings, linked lists, trees, sorting and searching, dynamic programming, design, math, sliding window pattern, Kadane's algorithm, backtracking, union find, depth first search, and breadth first search.

Uploaded by

Marina Atoyants
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Leetcode Categories

The document discusses different types of common algorithms and data structures used for coding interviews including arrays, strings, linked lists, trees, sorting and searching, dynamic programming, design, math, sliding window pattern, Kadane's algorithm, backtracking, union find, depth first search, and breadth first search.

Uploaded by

Marina Atoyants
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

# Task Types

1. Array
2. String
- use array or dicts for keeping the count
- use 2 pointers - eg for reversing the string or checking if it is a
palindrome
- char A into int (order in alphabet), convert str number into int
- sliding window
-
3. Hash Table
4. Dynamic Programming
5. Math?
6. Depth-First Search
7. Sorting
8. Greedy?
9. Breadth-First Search
10. Database?
11. Tree
12. Binary Search
13. Matrix

24. Heap (Priority queue)


25. Graph
26. Backtracking
27. Simulation
28. Prefix Sum

# Top Interview Questions

- array
- strings
- linked list
- trees
- sorting and searching
- dynamic programming
- design
- math
- other

# Approaches

## Sliding window pattern

### Static size


- fixed size
- both right and left pointers are moving

### Dynamic size


- right pointer is moving while left one is fixed
- until we reach max size of window
- then right pointer is fixed
- left one is moving - the window shrinks

```
find max sum sequence of size 3 in array
```

## Kadane's algorithm - maximum sum subarray


## Backtracking
https://leetcode.com/problems/target-sum/discuss/455024/DP-IS-EASY!-5-Steps-to-
Think-Through-DP-Questions.

Types of backtracking:
- 0/1 Knapsack
- Unbounded Knapsack
- Shortest Path (eg: Unique Paths I/II)
- Fibonacci Sequence (eg: House Thief, Jump Game)
- Longest Common Substring/Subsequeunce

## Union find
## depth first search
## breadth first search

You might also like