We’d love to hear any feedback or comment from you!

###### Engineering · Computer Science
Question details

Given humidity data for the days spanning from startDate to endDate inclusive, predict the hourly humidity data for each of the timestamps in timestamps.

Function Description:

Complete the function predictMissingHumidity in the editor below. The function must return an array of floating-point numbers where the value at each index i denotes the humity at timestamps[i].

predictMissingHumity has the following parameters(s):

startDate: string, the first day of humidity data in the format yyyy-mm-dd.

endDate: string, the last day of humidity data in the format yyyy-mm-dd.

knownTimestampsknownTimestamps[0]..knownTimestamps[m-1]: an array of strings of timestamps in the format yyyy-mm-dd hh:00

humidity[humidity[O],... humidity[m-1]]:: an array of floating point numbers representing humidity[i] occurring at at knownTimestamps[n-1],...timestampsltimestamps[n-1]]: an array of strings of timestamps to predict for in the format yyvy-mm-dd hh:00.

Constraints:

-2013-01-01 <= startdate <= enddate <= 2015-01-01

-1 <= m <= 3476

- 1<= n <= 915

Evaluation

-The predicted humidity at a timestamp is considered to be correct if the absolute difference between the actual and predicted humidity is not greater than .25.

-the accuracy of the prediction defined as (total number of correct prediction/n).

-The score for each test case is calculated as accuracy * (test case weight).

-the final score is the sum of all test scores

class Result {

/*

* Complete the 'predictMissingHumidity' function below.

*

* The function is expected to return a FLOAT_ARRAY.

* The function accepts following parameters:

* 1. STRING startDate

* 2. STRING endDate

* 3. STRING_ARRAY knownTimestamps

* 4. FLOAT_ARRAY humidity

* 5. STRING_ARRAY timestamps

*/

public static List<Float> predictMissingHumidity(String startDate, String endDate, List<String> knownTimestamps, List<Float> humidity, List<String> timestamps) {