FastPrepMaximize Array Beauty After Deletions
Problems/Maximize Array Beauty After Deletions

Maximize Array Beauty After Deletions

Point72 logoPoint72● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Point72 online assessment. The report asks you to delete array elements so as many kept positions as possible satisfy a[i] = i. It does not give the index base, the edge of a deletion, the exact interface, examples, or the limits. We use the usual subsequence setup, which fixes those details and keeps the reported goal. Our version is about 82% the same as the reported question.

You are given an integer array values. Delete any number of elements while preserving the relative order of the elements that remain. At least one element must remain.

The beauty of the final array is the number of its 1-indexed positions i for which the value at that position equals i.

Return the maximum beauty obtainable after deletions.

Function

maximizeArrayBeauty(values: int[]) → int

Examples

Example 1

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

Delete the third element to obtain [2,2,3,4]. Its values match positions 2, 3, and 4.

Example 2

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

Delete the first element. The remaining array is [1,2,3,4], so every position contributes to the beauty.

Example 3

values = [2,3,4,5]return = 0

No non-empty subsequence can place any of these values at an equal 1-indexed position.

Constraints

  • 1 <= values.length <= 200000
  • -10^9 <= values[i] <= 10^9

More Point72 interview questions

  • Simulate a Deterministic Finite AutomatonOA · Seen Aug 2026
  • Initial Public OfferingOA · Seen Jul 2026
  • Test the HypothesisOA · Seen Jul 2026
  • Get Triplet CountOA · Seen Jul 2026
  • Internet Service Provider Monthly ReportOA · Seen Jul 2026
  • Server SelectionOA · Seen Jul 2026
  • Lexicographically Smallest String After Substring OperationOA · Seen May 2026
  • Best Time to Buy and Sell Stock IIPHONE SCREEN · Seen Aug 2026
  • Find Minimum in a Rotated Sorted ArrayPHONE SCREEN · Seen Aug 2026
  • Generate an Optimal Portfolio Trading ReportPHONE SCREEN · Seen Apr 2026

Similar questions at other companies

  • Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
  • Split Array Largest SumAuxoAI · OA
  • Maximum Non-Decreasing Array LengthVisa · OAVisa interview questions
  • Min Elements to Remove to Make Almost Sorted ArraySalesforce · OASalesforce interview questions
  • Allocate Wells for Fair DistributionWells Fargo · OAWells Fargo interview questions
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Fill a Time Window with SongsMicrosoft · OAMicrosoft interview questions
  • Longest Increasing Subsequence from Two ArraysSquarepoint Capital · OASquarepoint Capital interview questions
  • Split Array Largest SumLinkedIn · OALinkedIn interview questions
  • Longest Increasing SubsequenceAtlassian · OAAtlassian interview questions
All Point72 interview questionsSee Point72 hiring insights
Saved
class Solution {
    public int maximizeArrayBeauty(int[] values) {
      // write your code here
    }
}
Checking account…