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

 

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

Write a method that swaps pairs of letters from the input parameter string. As a precondition, you may assume that the input parameter string contains an even number of characters. So "this" is a possible input parameter string, but "not" is not a possible input parameter string because it has an odd number of characters. Here is an example: Passing in "abcd" produces a result of "badc" because the a and b are swapped, then the c and d are swapped.


nov3_2017_APSLHL_swapPairs("") → ""
nov3_2017_APSLHL_swapPairs("gg") → "gg"
nov3_2017_APSLHL_swapPairs("aardvark") → "aadravkr"

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

public String nov3_2017_APSLHL_swapPairs(String str) { }

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: 280

Copyright Nick Parlante 2017 - privacy