Premium Content - Free Preview
This is a basic challenge to test out the interface and your
A 2-sum is the sum of a list of numbers, but every number that's next to a
2 is counted twice. Given a list of numbers, print out their 2-sum.
For example, when given
1 2 3 4 as input, print
14, the sum of the numbers with
3 counted twice.
As mentioned here, the challenges provide Standard Input and you need to print your solution to the output (with
System.out.println) . You are provided with boilerplate code which processes the input and passes it to the method