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

 

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

Write a method that accepts a string 'str' and how many characters you want to swap 'swap' between the front and back of the string. Note the order that the characters are swapped. As a precondition you may assume that 'swap' will be less than half the length of the string. Look at the test data for examples.


quiz2022_02_24_APSLHL_swapN("abcdefghijklmn", 2) → "nmcdefghijklba"
quiz2022_02_24_APSLHL_swapN("12345ABCDE", 3) → "EDC45AB321"
quiz2022_02_24_APSLHL_swapN("This is a quiz of much awesomeness", 6) → "ssenems a quiz of much awesoi sihT"

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

public String quiz2022_02_24_APSLHL_swapN(String str, int swap) { }

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

Copyright Nick Parlante 2017 - privacy