Skip to content

Commit d5f1c2b

Browse files
committed
added new problems
1 parent eadb202 commit d5f1c2b

File tree

1,084 files changed

+25972
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,084 files changed

+25972
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 1: Implement Trie (Prefix Tree)
2+
3+
## Problem Statement
4+
Implement a trie with insert, search, and startsWith methods.
5+
6+
## Input Format
7+
- Operations: insert(word), search(word), startsWith(prefix).
8+
9+
## Output Format
10+
- True/False for search and startsWith.
11+
12+
## Constraints
13+
- 1 <= word.length, prefix.length <= 2000
14+
15+
## Example
16+
**Input:** insert("apple"), search("apple")
17+
**Output:** True
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 10: Bloom Filter
2+
3+
## Problem Statement
4+
Implement a Bloom Filter for probabilistic set membership testing.
5+
6+
## Input Format
7+
- Operations: add(item), contains(item).
8+
9+
## Output Format
10+
- Boolean for contains (may have false positives).
11+
12+
## Constraints
13+
- 1 <= items <= 10^6
14+
15+
## Example
16+
**Input:** add("hello"), contains("hello")
17+
**Output:** True
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 11: Order Statistics Tree
2+
3+
## Problem Statement
4+
Implement a BST that supports select(k) — find kth smallest — and rank(x) in O(log n).
5+
6+
## Input Format
7+
- Operations: insert, select(k), rank(x).
8+
9+
## Output Format
10+
- Integer.
11+
12+
## Constraints
13+
- 1 <= n <= 10^5
14+
15+
## Example
16+
**Input:** insert(3,1,4,5,2), select(3)
17+
**Output:** 3
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 12: Interval Tree
2+
3+
## Problem Statement
4+
Build an interval tree to efficiently find all intervals overlapping a given interval.
5+
6+
## Input Format
7+
- A list of intervals and a query interval.
8+
9+
## Output Format
10+
- List of overlapping intervals.
11+
12+
## Constraints
13+
- 1 <= n <= 10^5
14+
15+
## Example
16+
**Input:** intervals=[(15,20),(10,30),(17,19)], query=(14,16)
17+
**Output:** [(15,20),(10,30)]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 13: Sparse Table
2+
3+
## Problem Statement
4+
Build a Sparse Table for O(1) range minimum queries after O(N log N) preprocessing.
5+
6+
## Input Format
7+
- An array, range queries.
8+
9+
## Output Format
10+
- Minimum in range.
11+
12+
## Constraints
13+
- 1 <= n <= 10^5
14+
15+
## Example
16+
**Input:** arr=[7,2,3,0,5,10,3,12,18], query(0,4)
17+
**Output:** 0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 14: Suffix Array
2+
3+
## Problem Statement
4+
Build the suffix array for a given string.
5+
6+
## Input Format
7+
- A string `s`.
8+
9+
## Output Format
10+
- A list of indices representing the suffix array.
11+
12+
## Constraints
13+
- 1 <= len(s) <= 10^5
14+
15+
## Example
16+
**Input:** s = "banana"
17+
**Output:** [5,3,1,0,4,2]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 15: Treap
2+
3+
## Problem Statement
4+
Implement a Treap (tree + heap) with random priorities for balanced BST operations.
5+
6+
## Input Format
7+
- Operations: insert, delete, search.
8+
9+
## Output Format
10+
- Boolean for search.
11+
12+
## Constraints
13+
- 1 <= n <= 10^5
14+
15+
## Example
16+
**Input:** insert(5), insert(3), insert(7), search(3)
17+
**Output:** True
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 16: Splay Tree
2+
3+
## Problem Statement
4+
Implement a Splay Tree that moves accessed nodes to the root.
5+
6+
## Input Format
7+
- Operations: insert, search, delete.
8+
9+
## Output Format
10+
- Boolean for search.
11+
12+
## Constraints
13+
- 1 <= n <= 10^5
14+
15+
## Example
16+
**Input:** insert(10), insert(20), search(10)
17+
**Output:** True
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 17: B-Tree Operations
2+
3+
## Problem Statement
4+
Implement basic B-Tree insertion and search operations.
5+
6+
## Input Format
7+
- Operations: insert, search, minimum order t.
8+
9+
## Output Format
10+
- Boolean for search.
11+
12+
## Constraints
13+
- 2 <= t <= 100
14+
15+
## Example
16+
**Input:** insert(10,20,5,6,12), search(6)
17+
**Output:** True
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem 18: AVL Tree
2+
3+
## Problem Statement
4+
Implement an AVL tree with self-balancing insertion and deletion.
5+
6+
## Input Format
7+
- Operations: insert, delete, search.
8+
9+
## Output Format
10+
- Boolean for search.
11+
12+
## Constraints
13+
- 1 <= n <= 10^5
14+
15+
## Example
16+
**Input:** insert(10,20,30), search(20)
17+
**Output:** True

0 commit comments

Comments
 (0)