Starting Challenge


Premium Content - Free Preview

This is a basic challenge to test out the interface and your if statement.

Challenge

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 1 and 3 counted twice.

Details

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 doStuff.


End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Comments

Contact Us