about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy