Example A. "(){}" is valid B. "({[]})” is valid C. “((})” is invalid
Friday, May 4, 2012
You are given a string of ‘n’ characters where n is even. The string only consist of 6 type of characters: (){}[]. The task is to form a well formed expression. A well formed expression consist of proper nesting of braces and their is no priority between the braces like [ > } > ). You can edit any bracket and change it to remaining types for accomplishing the task.
Labels:Data
DirectI Interview
Thursday, May 3, 2012
You are given a positive integer A. The goal is to construct the shortest possible sequence of integers ending with A, using the following rules
the first element of the sequence is 1,each of the successive elements is the sum of any two preceding elements (adding a single element to itself is also permissible),
each element is larger than all the preceding elements; that is, the sequence is increasing.
each element is larger than all the preceding elements; that is, the sequence is increasing.
For example, for A = 42, a possible solutions is [1, 2, 3, 6, 12, 24, 30, 42]. Another possible solution is [1, 2, 4, 5, 8, 16, 21, 42].
Labels:Data
Amazon Interview
Monday, April 30, 2012
Given a function bool Zoo(int x) and its called for y times , how you will generate the true with probability x/y times .
lest say if x = 65 & y=100, how will you generate true with probability 65/100. You can represent true by 1 and false by 0.
Labels:Data
Facebook Interview
,
Random Number Generator
Sunday, April 29, 2012
Find the kth smallest element in a (MxN) matrix.
PS:Think how efficiently u can do same for an array .
Labels:Data
Microsoft Interview
Tuesday, April 24, 2012
Three tips to succeed as a programmer
I Found its worth to read so thought to share.......
I've learned a lot of things over the years that I wish I knew before I graduated. From choosing the right job to figuring out where to focus in programming, here are three simple tips I’ve learned to help you as you embark on your career in software engineering.
1. Look for jobs that will let you program.
You didn’t spend the past four years studying this field to stop now, right? You want your job title to be ‘software developer,’ ‘software engineer,’ ‘programmer,’ ‘coder’ or whatever other name describes exactly what you want to do. So, make sure to steer clear of positions in marketing, testing, sales, etc. and seek out companies that are interested in hiring and mentoring you along your chosen career path.
2. Don’t give up on becoming a programmer.
Your education is only just about to begin. After spending years obtaining a degree, brace yourself because the amount of time you’ll spend working on collaborative projects is where the real fun kicks in. So far, you’ve probably been writing code, and that’s good. But to be a programmer, you need to learn how to read code. That’s the hard part because it requires you to understand, maintain, fix, and extend existing products. You will have to become very good at reading code and deciphering what other programmers intended to do.
This will be frustrating and hard. You’ll feel like you’re not good at it, like the job is too difficult, like you could do so much better if you only rewrote everything from scratch. But it’s not too hard, and with practice, you will get better, and you will understand. Expect it to take time, and know that the rewards are certainly worth it - good programmers can change the world.
3. Learn how to take charge of your career.
Spend some time to figure out if you want to work on front-end code, back-end code, new product, or something else. Ideally, you’ll get to move around and learn from each unique position. So, if there’s some new and interesting opportunity to move, raise your hand and find your spark. People are not likely to come searching for you when great opportunities show up because there are probably going to be plenty of other people to choose from.
This can be hard, but you need to get out of the mindset that you are being pushy, demanding or somehow greedy when you do this. I’m not saying you need to trample over everyone around you and fight to the death, nor am I saying that you should demand to be given a new task. What I am recommending is that you find a way to politely indicate your interest and excitement about the opportunity to the right people- your boss, whoever is in charge of the opportunity, possibly the lead developer, etc. Find out how you could be a part of it and make the transition. The worst-case scenario is that you are told you are not quite ready; in which case you can work on figuring out what else is needed and be ready for the next opportunity that comes up.
Part of managing your career means taking a stock of your personal progress once or twice a year, especially early on in your career. Are you achieving your goals? Are you getting more complex tasks? Is your work increasing in scope and importance? If you notice yourself stagnating, take action right away. You don’t want to find yourself five years after starting your job still at the same level as a college new grad.
So, remember: learn how to read code, dedicate yourself to programming and manage your career. Soon, you’ll be up and running in the programming world and making an impact.
Source: Goranka Bjedov is a capacity engineer on the Tech Ops team at Facebook. Goranka recently shared some of this advice at a computer science event with women from Mills College in Oakland, Calif.
I've learned a lot of things over the years that I wish I knew before I graduated. From choosing the right job to figuring out where to focus in programming, here are three simple tips I’ve learned to help you as you embark on your career in software engineering.
1. Look for jobs that will let you program.
You didn’t spend the past four years studying this field to stop now, right? You want your job title to be ‘software developer,’ ‘software engineer,’ ‘programmer,’ ‘coder’ or whatever other name describes exactly what you want to do. So, make sure to steer clear of positions in marketing, testing, sales, etc. and seek out companies that are interested in hiring and mentoring you along your chosen career path.
2. Don’t give up on becoming a programmer.
Your education is only just about to begin. After spending years obtaining a degree, brace yourself because the amount of time you’ll spend working on collaborative projects is where the real fun kicks in. So far, you’ve probably been writing code, and that’s good. But to be a programmer, you need to learn how to read code. That’s the hard part because it requires you to understand, maintain, fix, and extend existing products. You will have to become very good at reading code and deciphering what other programmers intended to do.
This will be frustrating and hard. You’ll feel like you’re not good at it, like the job is too difficult, like you could do so much better if you only rewrote everything from scratch. But it’s not too hard, and with practice, you will get better, and you will understand. Expect it to take time, and know that the rewards are certainly worth it - good programmers can change the world.
3. Learn how to take charge of your career.
Spend some time to figure out if you want to work on front-end code, back-end code, new product, or something else. Ideally, you’ll get to move around and learn from each unique position. So, if there’s some new and interesting opportunity to move, raise your hand and find your spark. People are not likely to come searching for you when great opportunities show up because there are probably going to be plenty of other people to choose from.
This can be hard, but you need to get out of the mindset that you are being pushy, demanding or somehow greedy when you do this. I’m not saying you need to trample over everyone around you and fight to the death, nor am I saying that you should demand to be given a new task. What I am recommending is that you find a way to politely indicate your interest and excitement about the opportunity to the right people- your boss, whoever is in charge of the opportunity, possibly the lead developer, etc. Find out how you could be a part of it and make the transition. The worst-case scenario is that you are told you are not quite ready; in which case you can work on figuring out what else is needed and be ready for the next opportunity that comes up.
Part of managing your career means taking a stock of your personal progress once or twice a year, especially early on in your career. Are you achieving your goals? Are you getting more complex tasks? Is your work increasing in scope and importance? If you notice yourself stagnating, take action right away. You don’t want to find yourself five years after starting your job still at the same level as a college new grad.
So, remember: learn how to read code, dedicate yourself to programming and manage your career. Soon, you’ll be up and running in the programming world and making an impact.
Source: Goranka Bjedov is a capacity engineer on the Tech Ops team at Facebook. Goranka recently shared some of this advice at a computer science event with women from Mills College in Oakland, Calif.
Labels:Data
FaceBook Engineering Team
Sunday, April 22, 2012
Given a number. And one permutation of that number. Find out in how many steps can you get back to the original number from the permutation if you use the same mapping again and again. If its not possible, then state so.
Example: 2315 -> 5213
So in this example Mapping is number at 1st index -> 2nd index
2nd index -> 4th index
3rd index -> 3rd index
4th index -> 1st index
So using same mapping can we come back to 2315. If yes then in how many steps?
So in this example Mapping is number at 1st index -> 2nd index
2nd index -> 4th index
3rd index -> 3rd index
4th index -> 1st index
So using same mapping can we come back to 2315. If yes then in how many steps?
Labels:Data
Amazon Interview
Given a dictionary of strings [ strings are in sorted order] you have to find the precedence of characters according to the dictionary..
e.g.
eat
bxy
e is ranked above b according to the dictionary
eat
bxy
e is ranked above b according to the dictionary
Labels:Data
Google Interview
Tuesday, April 17, 2012
Never Stop Hacking- A Good Post After Long Time :)
Though it comes out from some other programmer's heart but its pretty much reflects my life so thought to share it with readers .A must read for programmers :)
This is a quick post, something that I have to get out of my mind and onto paper (err, the internets!).
I was thinking earlier today about what makes me happy--really, truly happy. I had just stopped coding, and was feeling frustrated that my builds weren't working like I had hoped. I decided to go onto IRC for some procrastination, and ended up chatting with a really good friend.
My friend (who will remain unnamed), is an extremely smart fellow. One of the smartest I've ever had the pleasure of talking to. He's a fucking amazing programmer, always positive, and constantly learning new things. As we were talking about programming, I started to feel better. I started to feel excited. My frustration began to melt away, and all that was left was desire.
The desire to learn new things. The desire to build something that has never before been built. The desire to hunt down problems--and then solve them.
It was at this moment I realized something. Something which, to me, is an incredibly powerful revelation. Often times, I find myself hunting for solutions. I find myself desperately trying to figure out what I should do about X, and how to optimize Y. I find myself searching for solutions to problems, hoping to get them out of the way as quickly as possible so that I can move onto the next thing, the next chore, the next item on my todo list. It was in this moment that it all became clear to me--
I enjoy the problems. I crave them.
The more I focus on solutions, the more I treat them as a chore, as a task that needs to be finished--the more stressed and frustrated I become. It is only when I focus on the experience, the act of learning something new and hunting down problems, that I feel really, truly happy.
As programmers, we're given a unique gift: the ability to spend a majority of our time learning things and solving problems. The next time I'm feeling stressed, frustrated, or even angry--I'm going to remember that it's the process I really enjoy--that the process of learning new things is what really motivates me, and makes me love what I do so much.
Never stop hacking
Source Never Stop Hacking
Labels:Data
Never Stop Hacking
Subscribe to:
Posts
(
Atom
)