Citadel Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Maximize Stock Trading Profits Using Dynamic Programming
Scenario Evaluating dynamic-programming skills on stock-trading profits. Question Given an array of daily stock prices and an integer K, write Python ...
Implement Infinite Fibonacci Generator Using Lazy Evaluation
Scenario Testing understanding of Python lazy evaluation and generators. Question Explain what lazy evaluation means in Python and implement a generat...
Compute max team size with a core interval
You are given n employees’ working-time intervals, where employee i works during the inclusive interval [startTime[i], endTime[i]]. You want to form a...
Implement lazy unique-merge generator for sorted streams
Write a Python generator merge_unique(a, b) that lazily merges two nondecreasing iterables a and b (potentially infinite) into a single nondecreasing ...
Implement max profit with K transactions (DP)
Given an array prices[0..n-1] of daily stock prices and an integer k, implement a bottom-up dynamic program to compute the maximum achievable profit w...
Match a string with wildcard pattern recursively
Implement a function that checks whether an input string matches a wildcard pattern. Pattern rules - ? matches exactly one character. - * matches any ...
Solve four algorithmic problems
Answer the following independent algorithmic questions: 1) Count extendable prefixes for '10' subsequences: Given a binary string s and an integer k, ...
Find earliest common meeting slot
Given K participants' calendars, each a list of busy intervals [start, end) within a working window [workStart, workEnd], and a meeting duration d min...
Minimize image processing cost with discount
Question You have n images. For the i-th image, processing costs filterCost[i] per day and must run from startDay[i] to endDay[i] inclusive. Each day ...
Minimize changes for k-periodic palindrome
Question Given a string currentPassword (length N) and an integer k (1 ≤ k < N, N ≤ 2·10^5, lowercase letters, N divisible by k), find the minimum num...
Optimize password transform and discount scheduling
Part 1 — Transform to palindromic k-periodic string: Input: a lowercase string currentPassword and integer k. Constraints: 1 <= k < len(currentPasswor...
Implement two-pointer unique-pair sum search
Given a nondecreasing integer array nums and an integer target, return all unique value pairs [a, b] with a <= b such that a + b == target. Use the tw...
Explain hash maps and solve array intersection
1) Explain the internal implementation of a hash map: underlying array/bucket layout, hash function choice, collision resolution strategies (separate ...
Solve two DS&A optimization problems
Problem 1 — Maximize alternating-sum over four array partitions: Given an integer array arr[1..n] (1-based). Choose indices a, b, c with 1 ≤ a ≤ b ≤ c...