FastPrepMaximum MEX
Problems/Maximum MEX

Maximum MEX

Atlassian logoAtlassian● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. One picture in a second source shows an extra array value that does not fit, so we left it out. Our version is about 98% the same as the reported question.

Given an array arr of non-negative integers and a positive integer x, one operation adds x to or subtracts x from any array element. You may perform any number of operations.

The MEX is the smallest non-negative integer not present in an array. Return the maximum MEX that can be achieved.

Function

maximumMEX(arr: int[], x: int) → int

Examples

Example 1

arr = [0,1,2,1,3]x = 3return = 5

Add 3 to one occurrence of 1. The array can contain every value from 0 through 4, so its MEX is 5.

Example 2

arr = [1,3,4]x = 2return = 2

Subtract 2 twice from 4 to create 0. The value 2 cannot also be created from the remaining residues.

Constraints

  • 1 <= arr.length <= 100000
  • 0 <= arr[i] <= 10^9
  • 1 <= x <= 100000

More Atlassian Online Assessment questions

  • Planning ProductionOA · Seen Feb 2025
  • K-Means ClusteringOA · Seen Feb 2025
  • Minimum Sorted Erasure OperationsOA · Seen Jun 2024
  • Count Analogous ArraysOA · Seen Mar 2024
  • Get Maximum ScoreOA · Seen Mar 2024
  • Better Compression 🦀OA · Seen Mar 2024
  • Romanizer 🐡OA · Seen Mar 2024
  • Flower Bouquets 💐OA · Seen Mar 2024
  • Binary Search Tree IteratorOA · Seen Nov 2023
  • Binary Tree Level Order TraversalOA · Seen Nov 2023

Similar questions at other companies

  • Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
  • Count Subarrays with a Perfect-Square ProductMicrosoft · OAMicrosoft interview questions
  • Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
  • Task Scheduler with CooldownGoDaddy · OA
  • Minimize Adjacent Squared-Difference Cost with One InsertionMcKinsey & Company · OAMcKinsey & Company interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Get Triplet CountIBM · OAIBM interview questions
  • Minimum Values with Even Powers of TwoVisa · OAVisa interview questions
  • Resource AllocationMaven Securities · OAMaven Securities interview questions

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public int maximumMEX(int[] arr, int x) {
      // Write your code here.
    }

}
Checking account…