FastPrepPossible MEX Values After One Optional Increment
Problems/Possible MEX Values After One Optional Increment

Possible MEX Values After One Optional Increment

Citadel logoCitadel● MediumFULLTIMEOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report supplies the value range, the optional single increment, and the requested set of possible MEX values. The contract fixes sorted distinct output.

Given an array values of length n, each value is between 0 and n - 1. You may leave the array unchanged, or choose one element smaller than n - 1 and increment it by exactly one.

Return every distinct MEX that can result, in increasing order. The MEX is the smallest non-negative integer absent from the array.

Function

possibleMexValues(values: int[]) → int[]

Examples

Example 1

values = [0,1]return = [0,2]

Leaving the array unchanged gives MEX 2; incrementing the only 0 gives MEX 0.

Example 2

values = [0,0,1,3]return = [1,2]

MEX 2 is unchanged, while incrementing the unique 1 removes the last 1 and gives MEX 1.

Constraints

  • 1 <= values.length <= 200000
  • 0 <= values[i] < values.length

More Citadel Online Assessment questions

  • Busy IntersectionOA · Seen Sep 2026
  • Shortest Path in an Unweighted GraphOA · Seen Sep 2026
  • Maximize Workday EarningsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Minimum Changes for Palindromic BlocksOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Minimum Image Processing CostOA · Seen Jul 2026
  • Process SchedulingOA · Seen Mar 2026
  • Social Media SuggestionsOA · Seen May 2025
  • Best Sum Downward Tree PathOA · Seen May 2025
  • Price CheckOA · Seen Feb 2025
  • Palindromic Substrings (LC 647 :)OA · Seen Jan 2025

Similar questions at other companies

  • Count Overlapping Square PairsRamp · OARamp interview questions
  • Find Valid SET Card TriplesSnowflake · OA · PHONE SCREENSnowflake interview questions
  • Two Tribes from Taller-Person CountsIntuit · OAIntuit interview questions
  • Count One-Swap Number PairsCapital One · OACapital One interview questions
  • Get Triplet CountIBM · OAIBM interview questions
  • Sum of Pipeline Response TimesBloomberg LP · OABloomberg LP interview questions
  • Count Reverse-Digit PairsVisa · OAVisa interview questions
  • Count 2x2 Submatrices by Black CellsTikTok · OATikTok interview questions
  • Alternating Parity PermutationsGoldman Sachs · OAGoldman Sachs interview questions
  • Get Triplet CountPoint72 · OAPoint72 interview questions

Citadel interview experiences

  • Citadel Securities Quant Researcher Intern Loop: 1 Experience
  • Citadel Securities Research Engineer Interview: 1 Experience
  • Citadel Securities SWE Intern First Round: 2 Experiences
  • Citadel Securities Experienced SWE Interviews: 1 Experience
  • Citadel SWE Intern Later Rounds and Superday: 13 Experiences
  • Citadel SWE Intern First-Round Questions: 20 Experiences
All Citadel interview questionsSee Citadel hiring insights
Saved
class Solution {
    public int[] possibleMexValues(int[] values) {
        // Write your code here.
    }
}
Checking account…