Easy Puzzle Mountain problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
wtt
Forum Newbie
Posts: 8
Joined: Tue Mar 27, 2007 4:43 pm

Easy Puzzle Mountain problem

Post by wtt »

Hello everyone,

Did you guys work on UTF-8 before? If so, could you take a look at the problem below. I'd like to hear your thoughts about tackling this kind of problems.

It is about the software internalization. I couldn't find the specific group to ask, so I ask here and I hope you don't mind.

////////////////////////////////////
//////////////
////////////
Easy Puzzle Mountain

Part 1:
How many bytes long is the sequence for the code point whose UTF-8 representation begins with 0xE3?


Part 2:

0xA9 0xE3 0xB4 0xB1 0x54 0x98 0xB4 0x77
0x88 0x01 0xB2 0x8E 0x5D 0xAA 0xBB 0x66
0x9A 0xC4 0xB2 0x3F 0x8C 0xA3 0xDF 0xA0
0x90 0x4A 0x83 0x90 0x00 0xA2 0xA7 0x94
0x83 0x5C 0x5B 0x86 0x91 0xBF 0xAA 0x60
0xA1 0x47 0x89 0xB2 0xC4 0x89 0x50 0x99



Decode the puzzle and send the answer to Part 1
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I don't see how this is a database question.

Also, we don't normally do peoples' homework for them.
wtt
Forum Newbie
Posts: 8
Joined: Tue Mar 27, 2007 4:43 pm

Yes

Post by wtt »

feyd wrote:I don't see how this is a database question.

Also, we don't normally do peoples' homework for them.
But if you happen to see this kind of problem before, it would be nice to give me some hints, right?

Actually it is not homework problem. It is job interview problem... I wanted to learn more about Php, but it is always nice if I can get a job first... :)
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

It has almost nothing to do with PHP. If you're going for a PHP job interview and they are asking you stuff like that then I would be wondering if the employer really knew who he was looking for.
wtt
Forum Newbie
Posts: 8
Joined: Tue Mar 27, 2007 4:43 pm

It is about code internalization

Post by wtt »

jayshields wrote:It has almost nothing to do with PHP. If you're going for a PHP job interview and they are asking you stuff like that then I would be wondering if the employer really knew who he was looking for.
Those web application are mainly developed with PHP.

The company wanted to convert the english version to other languages as well. For example, Chinese, Japanese...
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

The correct answer to that "puzzle" is "Can you please explain the question in plain English?". If they answer no then run a mile from that company because what you see in an interview is always representative of what you'll see in the job even if the interviewer denies it. Do you really want to work with cryptic specifications you have to spend ages working out?
wtt
Forum Newbie
Posts: 8
Joined: Tue Mar 27, 2007 4:43 pm

wow, i found guru here!

Post by wtt »

onion2k wrote:The correct answer to that "puzzle" is "Can you please explain the question in plain English?". If they answer no then run a mile from that company because what you see in an interview is always representative of what you'll see in the job even if the interviewer denies it. Do you really want to work with cryptic specifications you have to spend ages working out?
You are just joking, right?

How did you do that? Could you give me some links, so I can look on this problem?

Also, How to tackle the part 1 question?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: wow, i found guru here!

Post by onion2k »

wtt wrote:
onion2k wrote:The correct answer to that "puzzle" is "Can you please explain the question in plain English?". If they answer no then run a mile from that company because what you see in an interview is always representative of what you'll see in the job even if the interviewer denies it. Do you really want to work with cryptic specifications you have to spend ages working out?
You are just joking, right?

How did you do that? Could you give me some links, so I can look on this problem?

Also, How to tackle the part 1 question?
You misunderstood. I haven't solved the puzzle. I'm saying that if you're presented with a question like that then the correct course of action is to ask for a better explanation. It's a stupid puzzle that's probably very simple if you've tackled that sort of thing before, but rather cryptic if you haven't.

Anyway, if you really want to solve it, the answer to the first question is "3 bytes". 16 bit UTF8 characters are always 3 bytes long and start with an E.
wtt
Forum Newbie
Posts: 8
Joined: Tue Mar 27, 2007 4:43 pm

Re: wow, i found guru here!

Post by wtt »

onion2k wrote:
wtt wrote:
onion2k wrote:The correct answer to that "puzzle" is "Can you please explain the question in plain English?". If they answer no then run a mile from that company because what you see in an interview is always representative of what you'll see in the job even if the interviewer denies it. Do you really want to work with cryptic specifications you have to spend ages working out?
You are just joking, right?

How did you do that? Could you give me some links, so I can look on this problem?

Also, How to tackle the part 1 question?
You misunderstood. I haven't solved the puzzle. I'm saying that if you're presented with a question like that then the correct course of action is to ask for a better explanation. It's a stupid puzzle that's probably very simple if you've tackled that sort of thing before, but rather cryptic if you haven't.

Anyway, if you really want to solve it, the answer to the first question is "3 bytes". 16 bit UTF8 characters are always 3 bytes long and start with an E.

I realized you were kidding.

But, hey, I have to crack this kind of problem to get into the door...

could you let me know whee did you learn them ? "16 bit UTF8 characters are always 3 bytes long and start with an E." I googled, but I couldn't find good resources.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: wow, i found guru here!

Post by onion2k »

wtt wrote:could you let me know whee did you learn them ? "16 bit UTF8 characters are always 3 bytes long and start with an E." I googled, but I couldn't find good resources.
I have no idea where I learnt it. I've been developing internet apps for over 10 years, it's just something I know.

EDIT: Here's a page that mentions it... http://en.wikipedia.org/wiki/UTF-8#Rati ... 27s_design ... "If it begins with E, it is 16 bit (expressed in 3 bytes),"
lewmur
Forum Newbie
Posts: 4
Joined: Mon Mar 19, 2007 12:29 pm

Re: Easy Puzzle Mountain problem

Post by lewmur »

wtt wrote:Hello everyone,

Did you guys work on UTF-8 before? If so, could you take a look at the problem below. I'd like to hear your thoughts about tackling this kind of problems.

It is about the software internalization. I couldn't find the specific group to ask, so I ask here and I hope you don't mind.

////////////////////////////////////
//////////////
////////////
Easy Puzzle Mountain

Part 1:
How many bytes long is the sequence for the code point whose UTF-8 representation begins with 0xE3?


Part 2:

0xA9 0xE3 0xB4 0xB1 0x54 0x98 0xB4 0x77
0x88 0x01 0xB2 0x8E 0x5D 0xAA 0xBB 0x66
0x9A 0xC4 0xB2 0x3F 0x8C 0xA3 0xDF 0xA0
0x90 0x4A 0x83 0x90 0x00 0xA2 0xA7 0x94
0x83 0x5C 0x5B 0x86 0x91 0xBF 0xAA 0x60
0xA1 0x47 0x89 0xB2 0xC4 0x89 0x50 0x99



Decode the puzzle and send the answer to Part 1
You might want to try this link:

http://www.cl.cam.ac.uk/~mgk25/unicode.html
jsquintz
Forum Newbie
Posts: 1
Joined: Mon Apr 02, 2007 3:32 am

The Answer

Post by jsquintz »

The answer is....

If you want a job at Facebook figure it out yourself. If you can't figure it out yourself how long do you think you will survive there anyway? The place is filled with Stanford/Harvard/Carnegie Mellon Grads.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

There is some interesting string-length statements and talk about code-points in that wikipedia article as well...

http://en.wikipedia.org/wiki/UTF-8#Adva ... advantages
ltdtl
Forum Newbie
Posts: 1
Joined: Sun Jan 28, 2007 1:21 pm

facebook probelm..

Post by ltdtl »

wtt, I really don't understand how you did not even mention that problem is from facebook's puzzle list.
As someone posted a reply above, figure it out by yourself if you really want to get a job there.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

If people want to discuss the puzzle itself, or unicode encoding, or whatever then PM me and I'll open the thread again, but as it's moved on to what amounts to snide comments about how the original poster didn't choose to disclose where he got the puzzle from I don't think this topic warrants any further discussion.
Locked