Chuck Norris puzzle discussion


For me, it came down to inserting a ‘0’ instead of a 0 when I padded to 7 chars. Of course it depends on your implementation.


You can use .zfill(7) to fix this issue.


Every time you get a binary code for a character you have to check if he’s 7 characters long if not fill the frontup.


Can someone please explain why this generates an error:

NSArray *array = @[@"a", @"b"];
NSLog(@"Array: %@", array);
NSString *str = array[1];
NSLog(@"Str: %@", str);

It works fine in Xcode…

This is the error I get:
/tmp/Answer.m:79:15: error: initializing ‘NSString *’ with an expression of incompatible type ‘NSArray’
NSString *str = array[1];
^ ~~~~~~~~
1 error generated.


I figured out a solution to my question, posted here in case anyone else needs it.
NSArray *array = @[@“a”, @“b”];
NSString *str = [array objectAtIndex:1];


Looking for reference materials

I have been playing around with code for as long as I can remember, but all these challenges are tough and I'm only in the easy category. Most of them I don't even know where to start. Are there any good references out there that I can use to get me up to speed. I love this site and I really look forward to being able to hold my own. Thanks


This is a cool Stanford class:

I came here from reddit, they have a sub for challenges, start with the oldest, depending on the language you use you can check other people’s solutions.

I have no experience with it, but everyone says to start with python.
Also every challenge here has taken me multiple days, so don’t get discouraged.


For #4:
I was writing it in Bash and ran into a problem where the space was translated to this:
instead of

In case someone else runs into it.


My code so far:

[code removed, please just paste the part you think funky]

This code works fine for the first two instances. Probs start with the percent char ‘%’. The char is pushed into input as 0100101 (7bit), right? So obviously I I first need to format it to an 8 bit binary value and after which, I’ll be able to pass it to my getChar() method.

Problem is, even when hard-coding/concatenating the missing values to “00100101”, I still haven’t managed to print the entire string (its not a loops issue), I always seem to be coming up a few chars short.
I tried a few sloppy conditionals to work around the issue, but it’s clear that i’m just not getting this. Any suggestions as to how to do it with my existing code? Thanks in advance!


Chuck Norris’ keyboard only has 2 keys: 0 and space! :smiley:


I am also seeking for the solution


hello everybody :slight_smile:
i think that the compiler has a little bug, because, my function don’t pass either the char ‘%’ nor the sentence.
But, i’ve write my function on “Visual Studio 2015” and my function work very well.

for example with the “%” char, i obtain:
Binary : 100101
Chuck Norris : 0 0 00 00 0 0 00 0 0 0

It’s correct answer no ?

Someone has an explain for me please?
PS: i write in C# ^^



Hi! I have a problem with Chuck Norris’ message (the last one). If there is someone who could give me a helping hand I would really aprecciate it. It seems to be the first space but I’m not sure. Damn Chuck Norris! hahaha
Thanks in advance

Found:  0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00000 0 0000 00 0 0 0 00 0 0 000
Expected:  0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00000 0 0000 00 0 0 0 00 0 0 00 

Here is the code:



Hi, it’s because the binary number has to be 7-bits length. The number you are reading is 6-bits, you have to add an extra zero at the beginning :slight_smile:


i have tried and it’s work with the case “%” but i’ve always the same issue with the sentence ^^
But thank you :slight_smile:


hi , i have the same problem , but i don’t know where is it in my code , if could help me i would appreciate it


cool story bro :sunglasses:


Hi all. There is a nice way to convert int into its binary string representation:

var number = 5;
var bits = Convert.ToString(number ,2);

Then the bit representation can be padded with 0s on the left, in order to always have e.g. 7 bits:

bits = bits.PadLeft(7,‘0’);

Feel free to visit and comment my solution (in fact 1st published :slight_smile:):
Admin EDIT Pls don’t share your solutions here


Not easy. 5 hours and still just one passed


Ive began learning C so i am doing some of the puzzles again.(was in C# before) I cant finish this one because of time complexity. Can someone who knows C help me??