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

 

simona1@sfusd.edu recursion1 > regularPaperFold
prev  |  next  |  chance

Take a piece of paper and fold it in half. Unfold it and there is one fold, which we'll signify with a "1". (A fold in the opposite direction would be a "0") If you fold the paper twice it will have three folds when you unfold it, and they will be in a "110" pattern. Fold a piece of paper three times, and you will see "1101100" as the sequence of folds. You should use the onesComplement and reverse functions as "helper" functions in your solution. See https://en.wikipedia.org/wiki/Regular_paperfolding_sequence for an illustration. (Adapted from Roger Frank).


regularPaperFold(1) → "1"
regularPaperFold(2) → "110"
regularPaperFold(3) → "1101100"

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

public String regularPaperFold(int numFolds) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy