Hack Forums
[C] c++ bit array challenge - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] c++ bit array challenge (/showthread.php?tid=6064139)



c++ bit array challenge - Tahh - Apr 6, 2020

I'd like to know if anyone has solved this problem on this site.

https://www.hackerrank.com/challenges/bitset-1/problem

Even all the submitted answers cause compile error and it doesn't seem like anyone has ever gotten it write.


RE: c++ bit array challenge - saltycracker - Apr 6, 2020

A few points on terms and operators..

Quote:S (modulo 2^31)


What is the ^ in this case? Is it raise to the power or is it XOR?
How are the parentheses significant?
What is the equivalent operation in C\C++ for modulo?

Just want to make sure the terms are understood before I look at this problem.


RE: c++ bit array challenge - 4Txe4y33C9zvNhMj - Apr 7, 2020

Just grabbed the first solution from the site, compiles fine on my system?


RE: c++ bit array challenge - Tahh - Apr 7, 2020

(Apr 7, 2020 02:22 AM)4Txe4y33C9zvNhMj Wrote:  Just grabbed the first solution from the site, compiles fine on my system?

For me when I try to compile it on the site it says the solution doesn't work.

(Apr 6, 2020 11:17 PM)saltycracker Wrote:  A few points on terms and operators..


What is the ^ in this case? Is it raise to the power or is it XOR?
How are the parentheses significant?
What is the equivalent operation in C\C++ for modulo?

Just want to make sure the terms are understood before I look at this problem.


I don't know how to interpret the problem, too advanced for me.


RE: c++ bit array challenge - kray - Apr 7, 2020

(Apr 6, 2020 11:17 PM)saltycracker Wrote:  A few points on terms and operators..


What is the ^ in this case? Is it raise to the power or is it XOR?
How are the parentheses significant?
What is the equivalent operation in C\C++ for modulo?

Just want to make sure the terms are understood before I look at this problem.

I believe, considering it is a constraint to the problem, it is not XOR but rather combinatorics towards the amnt of possible solutions.