FastPrepFind Max Heart Rate Difference
Problems/Find Max Heart Rate Difference

Find Max Heart Rate Difference

Google logoGoogle● EasyINTERNOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Special thanks: 77 shared this problem.

A health monitoring device recorded N consecutive measurements. At the K-th measurement, the device recorded heart rate heartRate[K] and activity level activityLevel[K] (possible levels are "Low", "Normal", or "High").

Find the maximum difference between the highest and lowest heart rate values within the same activity level over a single period.

Function

findMaxHeartRateDifference(heartRate: int[], activityLevel: String[]) → int

Examples

Example 1

heartRate = [100, 87, 90, 90, 125]activityLevel = ["Normal", "Normal", "Normal", "High", "Low"]return = 13

Within the three periods of "Normal" activity level, the heart rate ranges from 87 to 100, with the maximum difference being 13.

Constraints

  • 1 <= heartRate.length == activityLevel.length <= 10^5
  • 1 <= heartRate[i] <= 300
  • activityLevel[i] is "Low", "Normal", or "High".

More Google interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Operations to Make a SubsequenceOA · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • Build the Task HierarchyPendo · OA
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Two SumAmazon · OA · PHONE SCREEN
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Customer Signer ScreeningState Farm · OA
  • Minimum Magic Stones After MergesElevenLabs · OAElevenLabs interview questions

Interview reports that mention this question

  • Google OA: What It Tests (2026)

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int findMaxHeartRateDifference(int[] heartRate, String[] activityLevel) {
      // write your code here
    }

}
Checking account…