Code RoomSum readings linked list
MediumPrep Room Coding #1709

Sum readings linked list

Code reviewAlgorithms & data structuresMid–Senior~20 min

Review this Java aggregation.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1public long sumReadings(SensorStore store) {
2 List<Integer> data = new LinkedList<>();
3 for (Reading r : store.fetchAll()) {
4 data.add(r.getValue()); // ~1,000,000 readings
5 }
6 long sum = 0;
7 for (int i = 0; i < data.size(); i++) {
8 sum += data.get(i);
9 }
10 return sum;
11}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.