London | 26-March-SDC | Ammad Ur Rehman | Sprint 1 | Number Systems#425
Open
anosidium wants to merge 2 commits intoCodeYourFuture:mainfrom
Open
London | 26-March-SDC | Ammad Ur Rehman | Sprint 1 | Number Systems#425anosidium wants to merge 2 commits intoCodeYourFuture:mainfrom
anosidium wants to merge 2 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
reviewed
Mar 25, 2026
cjyuan
left a comment
There was a problem hiding this comment.
Since the answers in this exercise are fairly clear, can you check your work against the answers on
https://github.com/CodeYourFuture/Module-Tools/blob/solutions/number-systems/README.md?plain=1
Should you have any question regarding number systems, feel free to raise them in the comment of this PR.
cjyuan
reviewed
Mar 27, 2026
|
|
||
| How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)? | ||
| Answer: A binary number is a power of two if it has exactly one 1 bit, or equivalently if n & (n - 1) == 0 (for n > 0) | ||
| Answer: A binary number is a power of two if it has exactly one 1 bit, or equivalently if n & (n - 1) == 0 (for n > 0) (Actual answer: Test that it has exactly one 1.) |
There was a problem hiding this comment.
Do you know how this check, n & (n - 1) == 0 can determine numbers that are power of 2?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Answered all the questions.
Questions
It wasn’t easy and is still very hard. I need an explanation that really clicks for me.