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

 

konstans@stuy.edu > makeNoDoubleLetterWords
prev  |  next  |  chance

Recursively create a list of all possible words of size 'remaining' using the provided alphabet. (Due to codingbat limitations, all the letters are numbers) As an added restriction, do not allow consecutive letters to be equal. "121" is allowed, but "112" is not Since coding bat only checks returned values, you must always return the list. The base case should add the word to the provided list of words, and return that list. After all recursive cases complete, you should return the list as well.


makeNoDoubleLetterWords(1, "", "123", []) → [1, 2, 3]
makeNoDoubleLetterWords(2, "", "12", []) → [12, 21]
makeNoDoubleLetterWords(2, "", "123", []) → [12, 13, 21, 23, 31, 32]

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

ArrayList<String> makeNoDoubleLetterWords(int remaining, String partial, String alphabet, ArrayList<String> words){ }

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

Copyright Nick Parlante 2017 - privacy