Strict JSON Lines Sum (Stop Early)

JavaScript Hard 4 views
Back to Questions

Problem Description

First line n then n lines, each should be a JSON number. If any line is invalid JSON or not finite number, print LINE k and stop. Otherwise print the sum.

Input Format

Line1: n. Next n lines: JSON number.

Output Format

Sum or LINE k.

Sample Test Case

Input:
4 1 2 3 bad
Output:
LINE 4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next