Tag: arrays
Interview Questions
- Interleave gains and losses
- Find the balance point of a PnL series
- Best contiguous stretch of daily returns
- Two non-overlapping windows of fixed length
- Best two non-overlapping trades
- Coin change, fewest coins for an amount
- Longest shared prefix among tickers
- Two-sum in a sorted array, in one pass
- Trapping rain water with two pointers
- Fewest boats to carry everyone across
- Closest pair sum in a sorted array
- Container with most water
- Count flat PnL segments
- Count order pairs summing to a target size
- Count inversions in a price series
- Compact a sorted price ladder in place
- Distinct prices in every window
- First repeated order ID in a stream
- First ticker that trades exactly once
- Group numbers with the same digits
- Largest solid block in an order-book depth chart
- Find the duplicate number without modifying the array
- Longest balanced run of ups and downs
- Longest run of consecutive strike prices
- Longest streak of rising prices
- Longest run of trades within a cost budget
- Longest winning streak after erasing k losing days
- The symbol that dominates the tape
- Compute maximum run-up in one pass
- Longest time underwater
- Maximum drawdown from a return series
- Maximum drawdown, and report when it happened
- Compute maximum drawdown in one pass
- Best cumulative gain run
- Best compounding streak with sign flips
- Largest product of three daily returns
- Largest peak-to-trough drawdown
- Max profit with unlimited trades
- Best contiguous run of daily P&L
- Single trade with a holding period
- Max profit from a single trade
- How many k-minute windows beat the target average?
- Shortest window that reaches a target sum
- Best k-window with all-distinct elements
- Maximum sum window of size k
- Best uptick with a minimum holding gap
- Merge two sorted arrays in place
- Merge overlapping trading sessions
- Merge two sorted quote streams
- Fewest hops to reach settlement
- Adjacent swaps to group buys before sells
- The missing trade sequence number
- Stock span with a monotonic stack
- Largest rectangle under a bar chart
- Trapping rain between the bars
- Next greater price with a monotonic stack
- Resolve colliding buy and sell sweeps
- Does a pair of sizes differ by exactly d
- Sort a book of short, flat, and long positions
- Max of the array except self
- Trapping rain water
- Product except self, division allowed
- Handing out candy
- Product of array except self
- Rotate a circular price buffer by k
- Range PnL queries with prefix sums
- Find the minimum in a rotated sorted array
- Find a peak element
- First and last position of a target
- The single element in a paired sorted array
- Search in a rotated sorted array
- Find the missing sequence number with XOR
- Find the injected order id with XOR
- One id duplicated, one missing, find both
- Find the id that appears once among triples
- Find the unpaired message with XOR
- Days until a higher price
- The stock span problem
- Shortest run of trades reaching a target cost
- Count subarrays whose sum is divisible by k
- Longest subarray that sums to k
- Longest stretch with equal wins and losses
- Count subarrays with exactly k odd numbers
- Count subarrays that sum to k
- Three positions that net to flat
- Total price range covered by quotes
- Do any two trades fall within t nanoseconds
- Container with the most water
- Largest rectangle in a histogram
- Candy on the trading floor
- Shortest window that sorts the whole array
- Trapping rain water
- Two order sizes closest to a target
- Two-sum on a sorted price ladder
- Find two orders with a given size difference
- Count the pairs that fill a block
- Spot a repeated order id within a recent window
- Two-sum on a list of trade sizes
- Total traded volume per symbol
- Intersection of two watchlists
- Count windows whose average beats a threshold
- Count runs with at most k losing days
- Push zero-quantity fills to the end