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

 

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

Hobbits have a method of sending secrete messages to each other. They take a string of characters and first determine the smallest integer greater than 1 that does NOT divide the length of the string. That number becomes the "jump". A new string is then created by "jumping" through the original string, wrapping around after jumping past the end of the string. For example: "testing" has a jump of 2, so the new string is created by selecting "e" from "tEsting", then "t" from "tesTing", then "n" from "testiNg", then wrapping around to "t" from "Testing", etc. The encoded string therefore becomes "etntsig". Look at the test data for further examples. The string will have at least three characters.


hobbitLoreCode("jump") → "mujp"
hobbitLoreCode("two") → "wto"
hobbitLoreCode("testing") → "etntsig"

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

public String hobbitLoreCode(String orig) { }

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