about | help | code help+videos | done | prefs |
Write a method that returns a boolean array that represents the binary representation of 'num'. As a precondition you may assume that 0<=num<=255. The boolean array will have exactly 8 elements. The element in the 0th position is the 128's place in the binary number and the element in the 7th position is the 1's place in the binary number. Each element corresponds to the appropriate place value in the binary number. Look at the test data for examples. test2023_11_16_P1SLHL_toBinary(21) → [false, false, false, true, false, true, false, true] test2023_11_16_P1SLHL_toBinary(20) → [false, false, false, true, false, true, false, false] test2023_11_16_P1SLHL_toBinary(42) → [false, false, true, false, true, false, true, false] ...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: 260
Copyright Nick Parlante 2017 - privacy