Unary - puzzle discussion

Well, so far as I remember, we had to convert to seven figures, and I put eight. So if you want to start from what I obtained, rather suppress a 0 at the beginning.
But for sure it is better to give the correct size to begin with.
Or did I ill remember ? I do not remember having been alerted about the answer, or perhaps at a moment I was very busy, sorry.

Well, so far as I remember, we had to convert to seven figures, and I put eight. So if you want to start from what I obtained, rather suppress a 0 at the beginning.
But for sure it is better to give the correct size to begin with.
Or did I ill remember ? I do not remember having been alerted about the answer, or perhaps at a moment I was very busy, sorry.

I do not remember what the fourth test case was, perhaps one day I shall do that puzzle again.

Hi! Did any of you solve this problem? I do have the exact same solution and I’m quite sure it’s correct. I used C++ and hand-checked the last few characters, the representation of the last ‘e’ in the validator seems to be wrong.

I think there is an error in the solution. The value % is
char code 37
And the solution expects the binary to be: 0100101
It should be 8 binary digits though.
So it should be 00100101
For example if you go to this website it shows the binary equivalent to be 8 0’s and 1’s long.
http://www.unit-conversion.info/texttools/convert-text-to-binary/

It’s 7-bit ASCII here.

ASCII is a 7-bit encoding (128 chars). There is no standard/canonical 8-bit extended ASCII, but lots of such encodings.
The tool you mention uses UTF-8, it is equivalent to the following in Python3:

['{:08b}'.format(c) for c in my_input_string.encode('utf-8')]

Thanks,
I read in the description that it is 7 bit. It just wasn’t clear enough to notice it the first time I read it.

I can’t seem to append a string. Is that on purpose?

I have a problem with the last test Chuck Norris messages. Anyone can help?

Hi everyone,
I’m solving this in Java. So far I convert the array of bytes to one binary string, where each byte occupies 7 characters, in a for-loop. But I have a feeling it can be achieved with some one-liner (using lambdas, streams, whatever…). What do you think? Is it possible?

HOLY S***, THANK YOU VERY MUCH!
I was unable to find the error until I realized ( after reading your comment ) that I was adding leading zero outside of the loop so those 0 was added only once at the beginning.

1 Like

Problem with Kotlin

Kotlin do not compile

I can’t submit Kotlin code for this challenge. Here the exception raised at each submit :
Error: Could not find or load main class AnswerKt
Caused by: java.lang.ClassNotFoundException: AnswerKt

Someone else got this error ? I wonder if the bug comes from the server (even the provided start code triggers this error).

i just tried and had not any problem

the default start code compile too

1 Like

Yes indeed, it is my fault … >_< My IDE automatically add a line at the beginning of my code package myfolder. And it breaks everything … Sorry for my irrelevant question. ^^’

1 Like

It was hard to me , i have not ever think to use bitwise coding and lost myself into converting char[], string and vector, but i am feeling good right nowto succeed whatever the way.

Standard Output Stream:

“0 0 00 0000 0 00”

Failure

Found:

Nothing

Expected:

0 0 00 0000 0 00

(i have printf("\n"%s"",Res); before the return 0, returning my Result)

Your answer should end with \n, not start with it

1 Like

Thank you, i have the 3 first test cases good, but the last one (Message from chuck norris) is wrong, even if it’s the same logic i used.
Found:

0 0 00 00000 0 000 00 00 0 0000…0 000 00 000 0 0000 00 00 0 0 00 0 0 0 00 0 0 0 00 0 0 000 00 0

Expected:

0 0 00 0000 0 0000 00 0 0 0 00 …0 000 00 000 0 0000 00 00 0 0 00 0 0 0 00 0 0 0 00 0 0 000 00 0

Here is my code to convert MESSAGE to 7-bit ASCII. I ran into the same problems as others. I was using 8-bit failing to see the requirements (bad programmer!, bad programmer - missing your customer’s requirements…tsk tsk…). Once I modified it for 7 bit (PadLeft(7, ‘0’), all was well.

string MessageConvertedToBinary = string.Join("", Encoding.UTF8.GetBytes( MESSAGE ).Select( n => Convert.ToString( n, 2 ).PadLeft(7, ‘0’) ) );