Send your feedback or ask for help here!
Maybe there’s some math trick that helps you solve this directly but isn’t this only easy once you have the binary representation of the hexadecimal?
This might be super easy in Python3 but some languages don’t handle anything > 2^63 natively.
Hex to binary is easy to do one character at a time, you don’t need to convert the whole number at once.
Probably shouldn’t be in the easy section though, theres some knowledge needed and a few different steps.
I did it in C++ and I didn’t need any big number. As RoboStac said, you can obtain binary representation one character at a time, since the input is hexadecimal.
For information to anyone still searching, it is not needed to solve this problem to track the flips of the digits more precisely than with the use of ‘#’ (I did track each change individually and it’s of no use).
+RoboStac probably shouldn’t be in the easy section, there is a clear gap between it and euclid’s algorithm
Hey, still searching. In python. Not that easy for me.
i made a dictionnary and loop throught bit for flip seq and loop for each digit of number but pass test 1,2 and 4 only. Can figure out the issue
Still searching too. Could someone explain the first flips for test 6 : as I understand it, “555689abde1222” becomes “222e8a9##61555” after first flip ( necessarily “1” so vertical flip) and I stop here because there are two “#”. Where do I miss something ?
“555689abde1222” becomes “222e8a9##61555” after first flip
The statement said, “The # symbol means arbitrary shapes that don’t look like a valid hex digit.” It means it is still a “shape” and is allowed to happen as long as it does not happen at the very end.
“bd” flips to become shapes “##”. Flip again it returns to “bd”.
Well that changes everything… I now have a working code for this, but any test after 10 needs some serious optimisation to run and I’m not there yet. I’m wondering as well if this should be in easy or not?
Even in Python, converting to binary is much more expensive than processing character by character.
However, one needs to handle leading (binary) zeroes, which don’t count as flips. This seems doubtful to me, especially when there is a test case that starts with an hexa zero, hinting that leading zeroes are meaningful in hexa, but not in binary !
In the 6th test, I don’t understand why 555689abde1222 can become 55519bd6e8a222, as I can’t see any way for a 6 to be a 1.
I handled #, as for instance b becomes # when vertically flipped, I must convert it back to a b when flipped again.
If someone can help me, I’d be very grateful.
Look at your hands, they are also flipped physically.
I just realized that I forgot to reverse the order while flipping horizontally, my bad.
Thank you for your reply though
Yeah but again you do not need to track it. Think of this puzzle as a whole, meaning that multiple flips (may) lead to the same result as input, hence having the necessary optimisations to do the 10000 flips in the allowed time for the harder test cases.
That’s probably because you’re missing a horizontal flip, where the 5551xxx comes from the xxx1222.
Yeah, that was exactly my problem, the puzzle is now solved for me.