Exercises

Browse All Exercises

Search and filter across the entire exercise library.

97 exercises

hardPython
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
mediumPython
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-searcharraysalgorithms+4
mediumPython
Find Kth Largest Element
Implement a function that finds the kth largest element in an unsorted array without sorting the entire array. Your fun...
algorithmsheaparrays+5
easyPython
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-searcharraysalgorithms+4
easyPython
Merge Sorted Arrays In-Place
Write a function `merge_sorted_arrays(arr1, arr2)` that merges two sorted arrays into one sorted array. **Examples:** `...
arrayssortingtwo-pointers+4
hardPython
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-programmingalgorithmsoptimization+3
easyPython
Binary Search Implementation
Implement a binary search function that finds the index of a target value in a sorted array. **Function signature:** `b...
algorithmsbinary-searcharrays+8
mediumPython
Word Break Problem
Build a function that determines if a string can be segmented into words from a given dictionary. ## Function Signature...
dynamic-programmingstring-manipulationalgorithms+3
mediumPython
Longest Increasing Subsequence
# Longest Increasing Subsequence Implement a function that finds the length of the longest increasing subsequence (LIS)...
dynamic-programmingarrayssubsequences+4
easyPython
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...
fibonacciiterationspace-complexity+5
hardPython
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-treeserializationrecursion+6
easyPython
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-programmingrecursionfibonacci+4
PreviousPage 6 of 9Next