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

 

jebbert@volusia.k12.fl.us > bbb2swap
prev  |  next  |  chance

Write a method that swaps consecutive integers in an array and returns the swapped array. The array will have a length of at least two.


bbb2swap([3, 5, 2, 8, 3]) → [5, 3, 8, 2, 3]
bbb2swap([1, 2, 3, 4, 5, 6, 7]) → [2, 1, 4, 3, 6, 5, 7]
bbb2swap([4, 6, 8, 10]) → [6, 4, 10, 8]

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

public int[] bbb2swap(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: 290

Copyright Nick Parlante 2017 - privacy