Forum Posts
- 2 Answers Hi
How can i apply for phone call interview in amazon?
- marirockz93 October 02, 2013| Flag | PURGE - 0 Answers Gas Station Problem
We have a car that can travel distance D on the full tank, and a route of length L, with gas stations numbered 1 to n, and station i is in distance di from the start, d1 = 0. The gas at station i has price pi, which means that travelling one unit of distance with the gas purchased at that station has the cost of pi.
- Myth September 28, 2013
We need to decide at which stations to stop (including station 1 where we are stopped at the beginning) at how much gas to purchase at those station, so the cost of reaching the end of the route will be minimal.| Flag | PURGE - 0 Answers dp problem
hello all can some1 help how to approach this prob:
- raunaktalwar00 September 28, 2013
After travelling lot around the roads of Britain, our friend Sherlock has realised the vastness of Jim Moriarity's Powers.
He realises that his wisdom alone won't be sufficient in his march to victory.
He therefore visits the "Forest of Magic". As the name suggests, the forest is magical in the sense that it has magical portals which release "Magical aura" when activated.
The amount of Magical Aura is calculated in terms of "Mana Points".
On entering the forest he sees 'n' number of portals in front of him numbered from '0' to 'n-1' arranged in a straight line.
Each portal has a value written over it. He sees that the first and the last portals are damaged and cannot be activated (remain unactivated).
He can perform the following operations repeatedly to gain Magical Aura :
1. He can activate a portal 'x' (obviously not the first and the last one).
2. Let 'l' be the nearest unactivated portal to the left of 'x' and 'r' be the nearest unactivated portal to the right of 'x'.
3. On activating the portal 'x' he gains Mana points equal to the product of value of written over 'l' and the value written over 'r'.
4. A portal once activated cannot be activated again.
He stops when the above process cannot be continued anymore.
Note that 'nearest' is with respect to the portal currently being activated.
Now Sherlock is thinking what is the maximum amount of Magical Aura (Mana points) he can First line contains no of testcases 't'.
Next 't' testcases follow, first line of each is an integer 'n', representing number of portals inside the forest.
Next line contains 'n' space seperated integers which are the values written over the corresponding n portals.
Ouptut :
Output 'n' lines each having one integer denoting the maximum amount of Mana points he can gain for that particular testcase.
Constraints :
1 <= t <= 500
3 <= n <= 80
1 <= Value written over each portal <= 1000
Sample Input :
1
4
1 2 3 4
Sample Output :
12
Explanation :
We have only 2 choices :
1. Activate portal numbered 1 first, and portal numbered 2 next. The total Mana points are 1 * 3 + 1 * 4 = 7.
2. Activate portal numbered 2 first, and portal numbered 1 next. The total Mana points are 2 * 4 + 1 * 4 = 12.
So the answer is 12.gain in this process.??
plz help how to approch this??
Help him find this.| Flag | PURGE - 0 Answers dp problem
fdk
- raunaktalwar00 September 28, 2013| Flag | PURGE - 0 Answers Discard all cards
You have 13 sorted cards, every cards from "2 ,3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A".
- Roc September 26, 2013
you can discard all cards, according to some rules:
a pair of cards, like: 2,2
three cards, like: 8,8,8 or 8,9,10; J,Q,K
card A can convert to any cards as you wish, like: A -> 3
For example: Input: 2 2 3 4 5 5 6 7 8 8 9 9 9
you can discard: 2 2
3 4 5
5 6 7
8 8
9 9 9
output:
TURE
Input:
2 2 3 4 5 5 6 7 8 9 10 J A
āAā can be converted to āJā, so
you can discard
2 2
3 4 5
5 6 7
8 9 10
J J
output
TRUE| Flag | PURGE - 0 Answers PROGRAM
IN file system count the frequency of a word in descending order ,,,
- Rustam September 26, 2013| Flag | PURGE - 3 Answers Rotate The Matrix left by 90 degrees
As the question says, I need to take a matrix and rotate it left by 90 degrees. This is the solution I came up with. Just wanted to discuss your thoughts on this. Please feel free to point out problems if any. I welcome all your suggestions.
- Anup Saumithri September 22, 2013
And the code is
int[][] rotateLeft(int matrix[][])
{
int dim = sizeOf(matrix)/(sizeOf(matrix[0][0]) * sizeOf(matrix[0][0]));
int rotatedMatrix[dim][dim];
for(int i=0; i>0; i++)
{
for(int j=dim*dim; j>0; j-=dim)
{
*(rotatedMatrix+i+j) = *(matrix+i+j);
}
}
return rotatedMatrix;
}| Flag | PURGE - 0 Answers Java Memory Model and Synchronization
How Java Memory Model handles code reordering when synchronized keyword is used?
- Ghosh September 21, 2013
(I told that as per java specification code reorder should not happen, but he was asking more clear picture like is it possible to reorder inside the synchronized block or can not reorder with respect of out of synchronized block.)| Flag | PURGE - 0 Answers I was recently asked a algorithm question in interview at MazikPakistan
it was more of mathematical but i could not get to it...
- ameetpunshi7 September 21, 2013
Like an array A of size n...using decision tree technique prove lower bound problem on finding number of zeros in array A. :s I was like what quesiton is that :S so i just ended up sayin the lower bound will be theta(nlogn) but could not prove at that time...:S| Flag | PURGE - 0 Answers Internship interviews and job interviews
Hi, i'm a B.Tech 3rd year. Recently many companies like facebook, microsoft, samsung, amazon,directi etc visited out campus for internship recruitment. They only asked questions about algorithms and coding. What i want to know is, will the recruitment process for jobs be any different than this? I mean will they ask questions other than just asking the algorithms and coding in C++ or Will there be any questions from systems, databases etc? I read the book cracking coding interviews and it says in job interviews, most questions will be from algorithm part and they may ask about projects and a little bit of systems and other topics. But i'm not sure if they will do the same during campus interviews, can anyone please tell me if job placement interviews will be different from internship interviews?
- TheDarkKnight September 21, 2013| Flag | PURGE - 0 Answers Interview at Amazon
Hi everyone
- danielpiedrahita September 20, 2013
8 weeks ago I got a phone call from the hiring manager and he wants to give me an offer, but because of my immigration status he is looking options like send me to other location and then after one year transfer me to Seattle. because there's not more H1B visas until next year.
I'm very worried because the last time I talk with him was almost 6 weeks, I send an email to follow up the situation. but I didn't receive a reply till now. It's this mean the withdraw the offer? am I still in the process? I don't know what to think? How long I have to wait to move on?| Flag | PURGE