5 kyu
Count Obeying Bitmasks In The Range
19 of 21Jomopipi
Loading description...
Mathematics
Binary
Bits
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Python translation with 500 tests instead of 36736.
This was good fun, really made you think about the algorithm because a loop will simply not cut it, no matter how much case pruning you employ
Good kata, I hope to see more ranking votes so we can approve this one.
Reference solution used for the random test is wrong:
I tested this with an ultra efficient solution and a brute force solution, and both gives 22:
Fixed, sorry it took so long
In the example, how can 15 obey 3, 6, or 9, since it's larger than all of them?
a
obeysb
implies0 <= a <= b
. Combined with the masking thing, this should lead to no number ever obeying any other number.0 <= b <= a
may be intended?My mistake, updated
One moment, gotta reword stuff
Updated ; hopefully the new description is still clear