Software Engineer Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Convert stack samples to trace events
Question Implement convertToTrace(samples) that, given a chronologically ordered vector of stack samples (each sample contains a timestamp and a call-...
Implement in-memory DB querying
Question Implement an in-memory database that supports: 1. Querying the whole table and returning only selected columns (projection). 2. Adding WHERE ...
Detect shuffle-mode sequence
Question Given a playlist of distinct songs and two player modes—Random (each next song chosen independently and uniformly at random, with replacement...
Implement matrix-indexing and expression resolver
Question Given a text file path whose contents include a single block starting with a line like "[2,4]" followed by rows of equal-length characters (e...
Calculate area, flush probability, egg drops
Question Given two quarter-circles inside a 1×1 square (centers at bottom-left and top-right corners), find the exact area of their overlapping region...
Solve string merge and grid path tasks
Question Given two equal-length strings s1 and s2, create a new string by iterating i = 0 … n-1, comparing s1[i] with s2[n-1-i]: append s1[i]; if the ...
Compute minimum passes to collect numbers
Question You are given an array shelf of n distinct integers that is a permutation of 1…n. Starting with target = 1, you repeatedly scan shelf from le...
Allocate refund across payments
Question Given a list of completed payment transactions (each with payment method, date, and amount) and a refund amount R, write an algorithm that is...
Compute minimum passes over permutation
Question You are given an array shelf representing a permutation of the integers 1..n. Starting with target = 1, you repeatedly scan the array left-to...
Find exit URL via BFS API calls
Question Design and implement a function that, given a starting URL "/", performs BFS or DFS by repeatedly sending HTTP GET requests of the form GET "...
Process auth requests with fraud rules
Question Implement a function that, given a list of Authorization Requests (timestamp_seconds, unique_id, amount, card_number, merchant), outputs a hu...
Solve island and frequency problems
Question LeetCode 200. Number of Islands – given a 2D grid, count the number of connected islands of '1's using DFS/BFS/Union-Find. LeetCode 695. Max ...
Count uniques in sparse sorted array
Question A sorted array contains many duplicates but only a very small number of distinct values. Design an algorithm that counts how many unique numb...
Parse strings and find meeting slots
Question Given a text file where each line contains raw information, extract the user identifier and the numeric quantity on that line and store the r...
Find most frequent log user
Question You are given a list of log entries in string format, where each entry contains a username and an access timestamp separated by a delimiter (...
Solve sliding-window and heap problems
Question Design an algorithm using a sliding window to compute the maximum sum of any contiguous subarray of length k; explain time- and space-complex...
Remove elements to avoid k-prefix duplicates
Question Given two lists listA and listB and an integer k, delete elements from listB so that the first k elements of the new listB share no value wit...
Randomly partition array into k segments
Question Given a list of integers and an integer k representing the number of segments, write a function that randomly partitions the list into k non-...
Parse password from indexed matrix file
Question Given a filepath to a text file containing one index line [x, y] followed by a matrix of characters (origin at lower-left (0, 0)), return the...
Evaluate dependent variable expressions
Question Given a target variable name and a list of assignment strings of the form 'Ti = expression' where the expression is either a number, a single...