FastPrepEscape Game - Maximize Score
Problems/Escape Game - Maximize Score

Escape Game - Maximize Score

Microsoft logoMicrosoft● MediumOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Duplicate notice: This page is a duplicate of Maximum Escape Game Score. Please ignore this page and use the canonical version.

Given an integer array elements, in each round you may choose a value v, delete all elements equal to v from the array and add them to your score, while also deleting all elements equal to v + 1 or v - 1. Those neighboring values earn no points.

Repeat until the array is empty. Return the maximum score you can obtain.

Function

maxScore(elements: int[]) → int

Examples

Example 1

elements = [5, 6, 6, 4, 11]return = 27

First pick 11, scoring 11 points; there are no 10s or 12s to delete, leaving [5, 6, 6, 4].

Then pick 6, scoring 12 points, while deleting the 5 and 7. The 5 is removed, leaving [4].

Finally pick 4, scoring 4 points. Total: 27.

More Microsoft Online Assessment questions

  • Authentication SystemOA · Seen Nov 2026
  • Maximum String OperationsOA · Seen Nov 2026
  • Minimum Cost to Process Priority TasksOA · Seen Nov 2026
  • Most Visited Sprint MarkerOA · Seen Nov 2026
  • Maximum Escape Game ScoreOA · Seen Nov 2026
  • Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
  • Maximum Interactive Team SizeOA · Seen Nov 2026
  • Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
  • Minimum Cost K-Capable ModelsOA · Seen Nov 2026
  • Find Available Meeting RoomsOA · Seen Oct 2026

Similar questions at other companies

  • Maximum Points by Deleting ElementsIBM · OAIBM interview questions
  • Maximum Points by Deleting ElementsWalmart · OAWalmart interview questions
  • Bitwise XOR SubsequencesJP Morgan Chase · OAJP Morgan Chase interview questions
  • Bitwise XOR SubsequencesGoldman Sachs · OAGoldman Sachs interview questions
  • Get Maximum ScoreAtlassian · OAAtlassian interview questions
  • Longest Common Contiguous String SequenceIntuit · OAIntuit interview questions
  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum Subarray Sum with Equal EndpointsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Word BreakMoveworks · ONSITE INTERVIEWMoveworks interview questions

Microsoft interview experiences

  • Microsoft OA Questions, October 2026: 4 Experiences
  • Microsoft Experienced SWE Phone Screen: 1 Experience
  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public int maxScore(int[] elements) {
      // write your code here
    }

}
Checking account…