FastPrepGet Maximum Score
Problems/Get Maximum Score

Get Maximum Score

Atlassian logoAtlassian● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time online assessment. The report gives no numeric limits. We added limits that prices are positive. Our version is about 97% the same as the reported question.

Given daily stock prices in stockPrice, choose a non-empty subsequence of day indices in increasing order.

The subsequence is balanced when every consecutive chosen pair previous and current satisfies stockPrice[current] - stockPrice[previous] = current - previous. Its score is the sum of prices on the chosen days.

Return the maximum possible score of a balanced subsequence.

Function

getMaximumScore(stockPrice: int[]) → long

Examples

Example 1

stockPrice = [1,5,3,7,8]return = 20

Choose indices [1,3,4], giving prices [5,7,8]. Their differences equal the corresponding index differences, and the score is 5 + 7 + 8 = 20.

Constraints

  • 1 <= stockPrice.length <= 200000
  • 1 <= stockPrice[i] <= 10^9
  • The answer fits a signed long.

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
  • 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
  • Design HashMapOA · Seen Nov 2023

Similar questions at other companies

  • Maximum Escape Game ScoreMicrosoft · OA
  • Maximum Points by Deleting ElementsIBM · OA
  • Maximum Points by Deleting ElementsWalmart · OA
  • Bitwise XOR SubsequencesJP Morgan Chase · OA
  • Bitwise XOR SubsequencesGoldman Sachs · OA
  • Longest Common Contiguous String SequenceIntuit · OA
  • Optimize Discount Selection Under a Point BudgetPalantir · OA
  • Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum Subarray Sum with Equal EndpointsGoogle · ONSITE INTERVIEW
  • Word BreakMoveworks · ONSITE INTERVIEW

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)
See Atlassian hiring insights
Saved
class Solution {
    public long getMaximumScore(int[] stockPrice) {
      // Write your code here.
    }

}
Checking account…