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

 

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

Write a method that swaps pairs of numbers in an array. Note that the array can be any length, including length zero, even lengths, and odd lengths. Look at the test data for examples.


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

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

public int[] todays_2021_11_09_APSLHL_swapAdjacent(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: 220

Copyright Nick Parlante 2017 - privacy