AlaaShaker's Weblog

// untitled …

Alphabetic Phone Number Generator [Problem of the Week]

with 15 comments

Mmm, not quite problem of the “week” since it has been a while since I last posted a problem – I had a busy few weeks, my apologies!

Anyway, let’s move to the problem – another Microsoft interview problem. Sure you’ve all seen how phone pads hold three letters of the alphabet for every number you can press (except for 1 and 0). Check the photo below to know what I mean …

Phone Pad

The problem is simple. The input is a distinct, seven-digit number. The required output is all seven-character strings that could be generated from this number. Read the rest of this entry »


Written by AlaaShaker

October 3, 2008 at 12:12 am

The acmASCIS 2008-Online-Contest [acmASCIS, FCIS]

with one comment

Update: The contest has begun already. Deadline for submissions is 17th of Sept, 2008, at 10:00 pm.

announcement to current FCISians only … Read the rest of this entry »

Written by AlaaShaker

September 11, 2008 at 2:34 pm

Posted in Problems

Tagged with , , ,

Build your own Flash RSS Reader [Tutorial: Flash ActionScript 3.0]

with 197 comments


You’re building a website, and at some point, you decided that you want to show some RSS feeds to a couple of blogs or other websites. The options are limited between buying a good looking solution, or getting a free, ugly one, that usually bares the name of it’s creator website – which doesn’t seem appealing at all, especially that 90% of the time the reader doesn’t match your design!
So, here’s a quick tutorial that shows you how you could build your own RSS reader in Flash .. Read the rest of this entry »

Written by AlaaShaker

September 9, 2008 at 3:10 pm

Count Open Lockers SOLVED [Problem of the Week]

with 4 comments

Seems this week’s problem was quite easy – five winners in less than two days!

Such problem is meant to look overwhelming. It would be very pointless if you thought of solving it by drawing a diagram of 100 lockers and literally ‘performed’ the 100 passes to know the solution. If this was an interview, be sure that you’ll be kicked out before you notice it!

First thing, forget the brute-force solution, since – again – it’s all about how you tackle the problem; that’s what the interviewer wants to see.
Go for a random number and give it a try – perhaps you could notice a sequence or a pattern. Let’s pick, mmm, 8?! Sounds good to me .. Read the rest of this entry »

Written by AlaaShaker

September 3, 2008 at 4:12 am

Count Open Lockers [Problem of the Week]

with 16 comments

Last week’s problem was a mistake – I had to suffer LOTS of code tracing and compiling. I had a troublesome “code” week here and in work ..
Anyway, as a result, no coding this week – just pure brain-work!

This week’s problem is a brainteaser, also is asked in interviews. The main point behind it is to show your interviewer how you could think to solve difficult, vague problems. Here’s the problem ..


Suppose you are in a hallway lined with 100 closed lockers. You begin by opening all 100 lockers. Next, you close every second locker. Then you go to every third locker and close it if it is open or open it if it is closed (call this toggling the locker). You continue toggling every nth locker on pass number n. After your hundredth pass of the hallway, in which you toggle only locker number 100, how many lockers are open?

In a hall with k lockers, how many lockers remain open after pass k?

I’m sure I’ll get tons of questions about that, so here’s a second explanation: Imagine this hallway of 100 lockers. You make “passes” on these lockers .. Read the rest of this entry »

Written by AlaaShaker

September 1, 2008 at 2:37 pm

Link-the-Tree SOLVED [Problem of the Week]

with 2 comments

This week’s problem was was pretty easy – obviously for ACMers only!!

Anyway, here’s the solution. You were given a binary tree, not necessarily complete (most people overlooked this point, and hence they didn’t handle having nodes with only left or only right nodes – they just assumed that every node either has both or not!). The task was transforming that tree into a linked list by adding a Next pointer to the struct. Here’s a diagram that would make explaining such story much easier (my diagram, that’s why it sure looks better .. LOL):


On the left, you’ll find the original binary tree, along with two pointers, R and C, that I’ll use to solve the problem as you’ll see in a moment. On the right, this is the required output. Read the rest of this entry »

Written by AlaaShaker

August 28, 2008 at 9:15 pm

Posted in Problems

Tagged with , , ,

Link-the-Tree [Problem of the Week]

with 36 comments

Seems that last week’s problem was a bit difficult as Fouad stated in his last problem, so this weeks it’s an easier one .. not that easy though. It should be easy for all ACMers .. we’ll see!
I first met this problem in a physical Microsoft technical interview (and solved it a7l), which stresses how being an ACMer helped me a lot in passing interviews. Actually, that Microsoft interview is broken into four interviews: three in problem solving (= ACM) and one in System Architecture, Analysis and Design.

Anyway, here’s how this problem goes ..

Incomplete Binary Tree

You have a binary tree, not necessarily complete, where each Node holds two pointers (left and right) and a character as an identifier. Read the rest of this entry »

Written by AlaaShaker

August 24, 2008 at 4:08 pm