Maximum Gain from an Earlier to a Later Element
Asked at Citadel · Coding Questions · Difficulty: Easy · Last asked Feb 6, 2026
A list of integers is given in order. Find the largest gain obtainable by picking one element and then a later (or the same) position, that is, the maximum of `values[j] - values[i]` over all `i <= j`. If no later element exceeds an earlier one, the answer is `0`.
Loading the problem…
More Citadel interview questions
- LLM Fundamentals: Quantization, FlashAttention, Parallelism
- LLM Questions: Training Systems, Hardware, and Scaling
- OLS Regression Between Independent Gaussian Random Vectors
- EQR Alpha-Factor Research Deep-Dive + LLM Inference Stability
- Weighted Random Sampling with Insert - Delete
- When Does min x'Qx + c'x Have a Finite Minimum