FastPrepFinal and Maximum Health after Deltas
Problems/Final and Maximum Health after Deltas

Final and Maximum Health after Deltas

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes a starting value, ordered positive and negative health changes, returning the final and maximum values, including the starting value in the maximum, and a linear pass. We supplied the output order, what happens with no clamping, and limits. Our version is about 91% the same as the reported question.

Start at initialHealth and apply every signed delta in order without clamping. Return [finalHealth, maximumHealth], where the maximum includes the initial state.

Function

healthExtremes(initialHealth: int, deltas: int[]) → int[]

Examples

Example 1

initialHealth = 10deltas = [5,-3,8,-20]return = [0,20]

The final and peak values occur at different times.

Example 2

initialHealth = 7deltas = [-1,-2]return = [4,7]

The initial state remains the maximum.

Constraints

  • -1000000000 <= initialHealth <= 1000000000
  • 0 <= deltas.length <= 100000
  • Every intermediate value fits in a signed 32-bit integer.

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Book Reading EveningsGoogle · OAGoogle interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
  • Lift Total TravelInfosys · OAInfosys interview questions
  • Shell Command Counts with History ReferencesTikTok · OATikTok interview questions
  • Count Dropped RequestsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Recursively Expanded Shell Command CountsHudson River Trading · OAHudson River Trading interview questions
  • Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
  • First Value Below Both NeighborsCapital One · OACapital One interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int[] healthExtremes(int initialHealth, int[] deltas) {
        // Write your code here.
    }

}
Checking account…