7 kyu
Shared Bit Counter
260 of 2,409Anarki
Description:
Complete the method that returns true
if 2 integers share at least two 1
bits, otherwise return false
. For simplicity assume that all numbers are non-negative.
Examples
7 = 0111 in binary
10 = 1010
15 = 1111
7
and10
share only a single1
-bit (at index 2) -->false
7
and15
share 31
-bits (at indexes 1, 2, and 3) -->true
10
and15
share 21
-bits (at indexes 0 and 2) -->true
Hint: you can do this with just string manipulation, but binary operators will make your life much easier.
Fundamentals
Binary
Bits
Similar Kata:
Stats:
Created | Feb 16, 2017 |
Published | Feb 16, 2017 |
Warriors Trained | 4391 |
Total Skips | 108 |
Total Code Submissions | 8952 |
Total Times Completed | 2409 |
C# Completions | 260 |
Python Completions | 1017 |
Rust Completions | 133 |
JavaScript Completions | 550 |
C Completions | 197 |
Prolog Completions | 17 |
Haskell Completions | 51 |
Ruby Completions | 63 |
C++ Completions | 297 |
Nim Completions | 13 |
COBOL Completions | 4 |
Total Stars | 40 |
% of votes with a positive feedback rating | 94% of 432 |
Total "Very Satisfied" Votes | 384 |
Total "Somewhat Satisfied" Votes | 40 |
Total "Not Satisfied" Votes | 8 |
Total Rank Assessments | 12 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |