You are viewing a single comment's thread. Return to all comments →
Java 8 : I had to change the return type to long to solve this question.
public static long solve(int n, List<List<Integer>> operations) { double sum = 0; double times=0; double avg = 0; for(int i = 0 ; i < operations.size();i++){ int a =operations.get(i).get(0); int b =operations.get(i).get(1); int k =operations.get(i).get(2); times= b-a+1; sum = k*times; avg += sum/n; } return (long)avg; }
Seems like cookies are disabled on this browser, please enable them to open this website
Filling Jars
You are viewing a single comment's thread. Return to all comments →
Java 8 : I had to change the return type to long to solve this question.