Category: DSA Sheet
-
DSA SheetFind the Smallest Missing Positive Integer
Problem Statement (Asked By Stripe) You are given an array of integers. Your task is to find the smallest missing…
January 2, 2025
-
DSA SheetConstruct and Deconstruct a Pair
Problem Statement (Asked By Jane Street) The function cons(a, b) creates a pair of two elements. Implement two functions: For…
January 3, 2025
-
DSA SheetImplement an XOR Linked List
An XOR-linked list is a memory-efficient version of a doubly linked list. Instead of each node storing separate next and…
January 4, 2025
-
DSA SheetCount Decoding Ways for Encoded Messages
Problem Statement (Asked By Facebook) Given the mapping a = 1, b = 2, …, z = 26, and an…
January 5, 2025
-
DSA SheetCount Unival Subtrees in a Binary Tree
A unival tree (short for "universal value tree") is a tree in which all nodes have the same value. Given…
January 6, 2025
-
DSA SheetLargest Sum of Non-Adjacent Numbers
Problem Statement (Asked By Airbnb) Given a list of integers, write a function to compute the largest sum of numbers…
January 7, 2025
-
DSA SheetJob Scheduler Implementation
Design a job scheduler that accepts a function f and an integer n. The scheduler should execute the function f…
January 9, 2025
-
DSA SheetAutocomplete System Implementation
Build an autocomplete system that, given a query string s and a set of possible query strings returns all strings…
January 10, 2025
-
DSA SheetStaircase Climbing Ways
There is a staircase with N steps, and you can ascend either 1 step or 2 steps at a time….
January 11, 2025
-
DSA SheetLongest Substring with K Distinct Characters
Given an integer k and a string s, write a function to determine the length of the longest substring in…
January 16, 2025
-
DSA SheetEstimate π Using Monte Carlo Method
The formula for the area of a circle is given by πr². Use the Monte Carlo method to approximate the…
January 17, 2025
-
DSA SheetSelect a Random Element from a Stream
You are given a stream of elements that is too large to fit into memory. Write an algorithm to select…
February 3, 2025