Exercises
Browse All Exercises
Search and filter across the entire exercise library.
Filters
97 exercises
hard
Python
Median of Two Sorted Arrays
Find the median of two sorted arrays in O(log(m+n)) time complexity. Implement a function that takes two sorted arrays...
binary-search
arrays
algorithms
+5
medium
Python
Binary Search for First and Last Position
# Find First and Last Position in Sorted Array Implement a function that finds the first and last position of a target...
binary-search
arrays
algorithms
+4
medium
Python
Find Kth Largest Element
Implement a function that finds the kth largest element in an unsorted array without sorting the entire array. Your fun...
algorithms
heap
arrays
+5
easy
Python
Search in Rotated Sorted Array
Implement a function that searches for a target value in a rotated sorted array in O(log n) time complexity. A rotated...
binary-search
arrays
algorithms
+4
easy
Python
Merge Sorted Arrays In-Place
Write a function `merge_sorted_arrays(arr1, arr2)` that merges two sorted arrays into one sorted array. **Examples:** `...
arrays
sorting
two-pointers
+4
hard
Python
0/1 Knapsack Problem Solver
Implement a solution to the classic 0/1 knapsack problem using dynamic programming. Given a knapsack with a weight capa...
dynamic-programming
algorithms
optimization
+3
easy
Python
Binary Search Implementation
Implement a binary search function that finds the index of a target value in a sorted array. **Function signature:** `b...
algorithms
binary-search
arrays
+8
medium
Python
Word Break Problem
Build a function that determines if a string can be segmented into words from a given dictionary. ## Function Signature...
dynamic-programming
string-manipulation
algorithms
+3
medium
Python
Longest Increasing Subsequence
# Longest Increasing Subsequence Implement a function that finds the length of the longest increasing subsequence (LIS)...
dynamic-programming
arrays
subsequences
+4
easy
Python
Fibonacci with O(1) Space
Write a function that returns the nth Fibonacci number using O(1) space complexity (no arrays or additional data structu...
fibonacci
iteration
space-complexity
+5
hard
Python
Binary Tree Serialization and Deserialization
Implement functions to serialize a binary tree to a string representation and deserialize it back to the original tree s...
binary-tree
serialization
recursion
+6
easy
Python
Climbing Stairs
Build a function that computes how many distinct ways you can climb n stairs, taking 1 or 2 steps at a time. For exampl...
dynamic-programming
recursion
fibonacci
+4
Previous
Page 6 of 9
Next