FastPrepFastPrep
Problem Brief

Find Max Heart Rate Difference

INTERNOA
See Google online assessment and hiring insights

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

1Example 1

Input
heartRate = [100, 87, 90, 90, 125], activityLevel = ["Normal", "Normal", "Normal", "High", "Low"]
Output
13
Explanation
Within the three periods of "Normal" activity level, the heart rate ranges from 87 to 100, with the maximum difference being 13.
public int findMaxHeartRateDifference(int[] heartRate, String[] activityLevel) {
  // write your code here
}
Input

heartRate

[100, 87, 90, 90, 125]

activityLevel

["Normal", "Normal", "Normal", "High", "Low"]

Output

13

Sign in to submit your solution.