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

 

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

Write a method called strMasher that accepts a string and an integer. It then returns a new string made from the old string in the way explained in this example: Suppose our string is "ABCDEFGHI" and the number is 3. We will start with the first letter, then go down three letters, then go down another three letters like such: "ADG" but at the same time we will remove those letters from the original string leaving: "BCEFHI". We now repeat this process giving "BF" and leaving "CEHI" which will then repeat the process giving "CI" and leaving "EH". This continues until all the characters in the string are used up. Return a string that is made up of all the removed letters in the order in which they were removed. Look at the sample data for clarification.


strMasher("Winston", 4) → "Wtinnso"
strMasher("Churchill", 3) → "Crihhulcl"
strMasher("Churchill", 2) → "Cucilhhrl"

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

public String strMasher(String str, int num) { }

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