Amazon Interview | Set 27

Amazon Interview | Set 27

Hi, I was recently interviewed for SDE1 position for Amazon and got selected. I have 1.5 year experience in java. Geeksforgeeks helped me lot. I am very thankful to Geeksforgeeks team. Following were interview questions-

Two telephonic rounds followed by 5 F2F interviews.

Round 1 (Telephonic):

1. There is a dictionary already implemented. Write a method, which takes input String without space, to prints all subsets of the input string which is present in dictionary.

Example: Dictionary – a*
………….Input- aaabaa
………….Output- a,a,a,aa,aa,aaa,a,a,aa

2. There is a dictionary already implemented. Write a method , which takes input String without space, to replace the characters from the strings which are not present in dictionary with –

Example: Dictionary – a*
………….Input- aaabaa
………….Output- aaa_aa

Interviewer was cool. Did not code properly (lots of bugs were in code), but gave good approach for first question. For second question solution sent in a mail.

Round 2 (Telephonic):

1. Write a program to remove duplicates from array of prime numbers.

2. Write a program to return nearest elements from a binary search tree for input element.

This round was very good. Interviewer was very happy with my approach for both questions. Code did not have big bug.

Round 1 (F2F- Problem Solving and coding):
1. Tell me about yourself.
2. Write a program to find top 10 elements on an array of integers.
Don’t remember much. Questions were easy. This round was very good. Interviewer was happy with solution.
3. Write a program to calculate a^b and store it in floating point representation.

Round 2 (F2F- Computer Fundamental):
1. Tell me about experience in past job.
2. OOPS concepts- Polymorphism, Inheritance, Encapsulation, Abstraction.
3. Aggregation and Composition.
4. Design patterns which you have implemented.
5. Write code to implement Singleton design pattern.
6. Design a system to implement options in Pack of cards.
7. Difference between Windows and Unix.
8. Threads, Synchronization, Deadlock.
9. Other subjects which you studied in your academics.
10. Most challenging work you ever faced.
11. Discussed about current project, role.
This round was fair enough. I was not able to discuss questions on subjects which I studied in academics.

Round 3 (F2F- Data Structures and Algorithms):
1. Tell me about yourself.
2. There is a 2d array. Write code to find the path with maximum sum. You can only traverse i+1 or j+1.if i is row number and j is column number.
I solved it using dynamic programming
3. In a binary tree find the least common ancestor for two nodes. (Write code)
4. Similar to 3rd question. Write a program to find least common ancestor in binary search tree.
This round was very good. Finished it only 40 mins.

Round 4 (F2F- Managerial round):
1. Tell me about yourself.
2. Copy Linked list with orbit pointer.
3. Write a code to find top hundred elements in a data set which cannot be loaded in RAM.
4. Typical parenthesis checking problem.
5. Most challenging work you ever faced.
6. What will do if you get task which is ambiguous.
7. At what extend you will be frustrated if you always get ambiguous problems.
8. How many members in your team in current organization. What’s your role? Questions on current project.

Interviewer was very cool and friendly.

Round 5 (F2F- Bar raiser round):
1. Tell me about yourself.
2. Discussed about current project.
3. Write a program to find number of inversions in an array.
Example- Array 2, 5, 3, 1,10
Inversions (2,1) , (5,1), (3,1), (5,3)
Answer will be – 4
Gave solution of complexity o(nlogn) . Interviewer gave me hint for that.
Hint- Divide and conquer approach.
He asked me to write code which doesn’t have any bug.

This article is compiled by Neha Gupta. Many Many congratulations to Neha. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to [email protected] See your article appearing on the GeeksforGeeks main page and help other Geeks.

时间: 2024-11-05 18:47:48

Amazon Interview | Set 27的相关文章

Find longest contiguous sub array

It's still an Amazon interview question. Given an array containing only stars '*' and hashes '#' . Find longest contiguous sub array that will contain equal no. of stars '*' and hashes '#'. Think for a while...... Typical DP-solved question. 1 /*****

Select the best path in a matrix

I feel a little down recently.But just like Lady Antebellum's song says,there are a lot of ups and downs in life,so I choose to learn from the defeat. Amazon interview question: Given a 2-dimensional array with arbitrary sizes and contains random pos

hosts代理

hosts代理文件:C:\Windows\System32\drivers\etc\HOSTS 内容如下: # Copyright (c) 2014-2016, racaljk. # https://github.com/racaljk/hosts # Last updated: 2016-5-23 # This work is licensed under a CC BY-NC-SA 4.0 International License. # https://creativecommons.or

Google Hosts (2015.11.03)

## # Copyright (c) 2014-2015, racaljk. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY. Redistribution and use in anyway, DO # NOT remove these and follow comments. # # Host Database # # localhost is use

googlehosts

# Amazon AWS Start27.0.1.125 ap-northeast-1.console.aws.amazon.com54.240.226.19 ap-southeast-1.console.aws.amazon.com54.240.195.197 ap-southeast-2.console.aws.amazon.com176.32.100.36 aws.amazon.com72.21.194.168 console.aws.amazon.com54.239.54.107 eu-

ubuntu下配置hosts

由于Chrome浏览器访问问题,需要配置hosts. 在Ubuntu系统下,需要修改/etc/hosts文件,修改完之后要重启网络.具体过程如下:1.修改hostssudo vi /etc/hosts2.添加解析内容 # Copyright (c) 2014-2016, racaljk. # https://github.com/racaljk/hosts # Last updated: 2016-5-23 # This work is licensed under a CC BY-NC-SA

吉萨法律时间浪费拉丝粉;阿里山

http://www.ebay.com/cln/tmotshu/book/157890749018/2015.01.27.html http://www.ebay.com/cln/tmotshu/book/157890755018/2015.01.27.html http://www.ebay.com/cln/tmotshu/book/157890757018/2015.01.27.html http://www.ebay.com/cln/tmotshu/book/157890775018/20

《Cracking the Coding Interview》——第16章:线程与锁——题目5

2014-04-27 20:16 题目:假设一个类Foo有三个公有的成员方法first().second().third().请用锁的方法来控制调用行为,使得他们的执行循序总是遵从first.second.third的顺序. 解法:你应该想到了用lock的方法类阻塞,不过这里面有个概念问题使得直接用ReentrantLock不能通过编译(对于一个锁对象,不同在A线程中锁定,又在B线程中解锁,不允许这样的归属关系),可以用Semaphore来达到相同的目的.请看下面的代码. 代码: 1 // 16

《Cracking the Coding Interview》——第16章:线程与锁——题目3

2014-04-27 19:26 题目:哲学家吃饭问题,死锁问题经典模型(专门用来黑哲学家的?). 解法:死锁四条件:1. 资源互斥.2. 请求保持.3. 非抢占.4. 循环等待.所以,某砖家拿起一只筷子后如果发现没有另一只了,就必须把手里这只筷子放下,这应该是通过破坏"请求保持"原则来防止死锁产生,请求资源失败时,连自己的资源也进一步释放,然后在下一轮里继续请求,直到成功执行. 代码: 1 // This is the class for chopsticks. 2 import j