Chuck Norris puzzle discussion


#260

I can’t solve the last problem.
Which action do I have to do?


#261

Yo, I get a weird error coming from outside my code.
It persists even when I put all my code in comment and only write return 0; in the main function.
I’m using C++.
Here is the error message:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x20): undefined reference tomain’
collect2: error: ld returned 1 exit status

The only puzzle I’ve encountered this problem with.
What should I do?


#262

Hey AchrafLy did you figure out what was the problem with ur solution? i have same issue


#263

In the last Chuck Norris message, when i convert the whole message to a binary message, there are 14 leading zeros that are not taken into consideration.
I then format this binary message to a message that has a 7*MESSAGE.length() character, that means adding 14 leading zeros, the message length is 53 and I get 371 characters including the leading 0.

The problem is in the solution they don’t take the 14 leading zeros into consideration. Anyone had the same problem?

Edit: I got it,the binaries need to be formatted before the concat


#265

Hi…
I can not achieve this puzzle because I don’t know how to convert the input in 7 bits… I’ve currently the following code, which doesn’t work : https://pastebin.com/k03484pS
(sorry for my bad English by the way)


#266

Split your string in chars then write your char (ASCII) in binary.


#267

I translate my chars in binary one a time by getting the cases of a table… I don’t use the String gotten in input


#268

my result for the last Ex is good but codinggame say no :frowning:


#269

Hey guys, I’m pretty confused rn, in ruby when I use

message.unpack(“B*”)[0]

I get

01000011

Instead of what I expected to be 1000011

Any tips ?


#270

while (mybin.Length<7)
mybin = “0”+mybin;


#271

Hi, I’m coding in c++ and the test tells me my method take too much time, but I don’t find a fastest way to convert it so … here’s my code :

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;
string convertbin(string mes);
string bintoChuck (string mes);



int main() 
{
    string MESSAGE;
    getline(cin, MESSAGE);

    string binans = convertbin(MESSAGE);
    string ans = bintoChuck(binans);

    cout << binans << endl;
}
string convertbin(string mes) {
    string bin;
    for (int counter = 0; counter < mes.length(); ++counter)
    {
        char s = mes[counter];
        bitset<7> bits(s);
        bin += bits.to_string();
    }
    // Return string passed by arguement
    return bin;
}
string bintoChuck(string mes) {
    int bigCount(0);
    int count(0);
    string ans;

    do {
        if (mes[bigCount] == 1) {
            ans += "0 ";
        }
        else {
            ans += "00 ";
        }

        do {
            ++count;
        } while (mes[bigCount + count] == mes[bigCount]);



        for (int i(0); i != count; ++i) {
            ans += "0";
        }
        ans += " ";
        bigCount = count;
        count = 0;

    } while (bigCount != mes.size());
    return ans;
}

#272

I’ve made an python oneliner abomination, is there anything to improve?

print(' '.join([['00','0']['1' in ele]+' '+'0'*len(ele) for ele in ''.join(['0'*(7-len(format(ord(chr), 'b')))+format(ord(chr), 'b') for chr in list(input())]).replace('10', '1 0').replace('01', '0 1').split()]))

#273

how do I update my “published” solution?

I have a much more “Kotlinesque” solution from my original


#274

Here’s how to do it:

  • go to your original solution and click the button “published” to unpublish it. (I know we should change the label)
  • go to your solutions tab, find the latest one and publish it

#275

except that k symbol in ascii is 107 which convert to 1101011 and not 100000… maybe I missed something


#276

Moreover space symbol is 0100000 then is the answer taking the space before the k ? Inversion of symbol in the expected answer maybe ?