about | help | code help+videos | done | prefs |
A non-negative integer 'num' is passed in as a parameter. Your goal is to determine the bitwise parity of the binary representation of that number. For example, 5, in binary is 101. That binary representation has a even number of 1's and therefore has even parity. Write a method that returns 'true' if 'num' has even pairty or 'false' if 'num' has odd pairty. Note that this is NOT about whether 'num' is an even number or not. It IS about the number of 1's in the binary representation of 'num'. test2023_11_02_SLHL_pairty(154) → true test2023_11_02_SLHL_pairty(22) → false test2023_11_02_SLHL_pairty(345) → 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: 280
Copyright Nick Parlante 2017 - privacy