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.
ᡣ • . • 𐭩 ✎𓆙Credit to 77
Examples
01 · 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.
More Google problems
- Periodic Table Word FormationsPHONE SCREEN · Seen Jun 2026
- Fountain SafetyONSITE INTERVIEW · Seen Jun 2026
- Consolidate On-Call RotationsOA · Seen Jun 2026
- Detonate Bombs with Chain ReactionsONSITE INTERVIEW · Seen May 2026
- Evaluate a Nested Math ExpressionONSITE INTERVIEW · Seen May 2026
- Tic-Tac-Toe Game StatusPHONE SCREEN · Seen May 2026
- Longest Dictionary TokenizationPHONE SCREEN · Seen May 2026
- Minimum Cars for Rental RequestsONSITE INTERVIEW · Seen Apr 2026
public int findMaxHeartRateDifference(int[] heartRate, String[] activityLevel) {
// write your code here
}
heartRate[100, 87, 90, 90, 125]
activityLevel["Normal", "Normal", "Normal", "High", "Low"]
expected13
sign in to submit