Tuesday, November 06, 2007


"Given a 2D representation of skyscrapers in which each building is represented by {x1,x2,y} meaning the building is from x1 to x2 on x axis and is of height y, write a function which will draw the skyline" . (Refering the picture below, given the black rectangles, you have to draw the red line !)"

Mar 19th 2004.... Park Sheraton Hotel Chennai.... I was presented with this problem to solve. 1 hour was the time allotted to crack this. I came up with all possible brute force methods... none of them seemed convincing enough to solve this in algorithmic fashion. Time was up..but yet I didn't give up thinking through this problem. Then came a strategy which struck me out of the blue and the solution was correct( or atleast closest to one of the correct ones) ! Bingo.. I was elated and was so happy about that luck or fate which was with me that day ! Least did I know then that solving this problem will remain as one of the important factors of me getting to see these real skyscrapers and skylines :)

Yes. That problem was the deciding question of my interview with Microsoft India and here I'm writing this from my office in Microsoft Corporation, Seattle !! What an amazing journey from the paper skyline to the Seattle skyline...

Life is amazing ! You never know what it is going to present you with in the next second... but thats what make it amazing ! ( Stolen from Kamal Hassan's words from Anbe Sivam... "Adutha vinaadi ozhithu vaithirukkum aaacharyangal pala kodi.... " )


Post a Comment

<< Home