forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice > transpose
prev  |  next  |  chance

You want to transpose two letters in a String. In addition to the input String, you have indices x and y which represent the position of the characters you need to swap. Returned the String with the chars swapped.

transpose("hello", 0, 4) → "oellh"

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

public String transpose(String str, int x, int y) { }

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: 200 Post-solution available

Copyright Nick Parlante 2017 - privacy