id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

srp4379@lausd.net quiz > middleWayTwice
prev  |  next  |  chance

int[] middleWayTwice(int[] nums). Given an array with an ODD number of elements, return a new array that has exactly 2 elements. The 1st element of the new array will be the middle element of the input array. The 2nd element of the new array will be TWICE the value of the middle element of the input array.


middleWayTwice([1, 2, 3, 4, 5]) → [3, 6]
middleWayTwice([10, 6, 12, 40, 25]) → [12, 24]
middleWayTwice([40, 66, 213, 401, 125, -26, 92]) → [401, 802]

...Save, Compile, Run (ctrl-enter)

int[] middleWayTwice(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 105

Copyright Nick Parlante 2017 - privacy