about | help | code help+videos | done | prefs |
Write a method that returns a string for the "funny" binary representation of the positive integer 'num'. What makes it a "funny" binary representation is that instead of using 1's and 0's, you are using whatever character(s) are represented by the strings 'one' and 'zero'. For example, the integer 4 can be represented in binary as "100", but if 'one' was "!" and 'zero' was "[", you would instead represent it as "![[". Note: 'one' COULD be "1" and 'zero' COULD be "0", in which case your resulting string should look exactly like 'num' represented in binary would look. Preconditions: 'num'>0; 'one' and 'zero' are non-emptry strings. test2023_06_01_P1SL_funnyBinary(235, "A", "B") → "AAABABAA" test2023_06_01_P1SL_funnyBinary(9, "A", "B") → "ABBA" test2023_06_01_P1SL_funnyBinary(12453, "J", "+") → "JJ++++J+J++J+J" ...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: 250
Copyright Nick Parlante 2017 - privacy