# Top 20 Amazon and Google Programming Interview Questions

Hello, In this article I am going to sharing some frequently asked programming job interviews from technical giants and startups. If you are going for a programming job interview with Microsoft, Google or Amazon, you better be prepared for  all kinds of questions. These companies are known to ask tough questions, tricky puzzles and lots of data structure and algorithm questions. Since it's hard to prepare all these in a short time, it makes sense to at least have a good idea of frequently asked programming questions in Microsoft, Google or Amazon. There are a lot of questions spread across the internet and if you are good in googling (not to mention, an important surviving skill in programming job), you can get tons of questions asked in these companies, or you can read Cracking the coding interview book, which contains 150+ programming questions and their solutions.

This list of programming question is a mix of difficult, tricky and easy questions, mostly collected from previous interviews on Google, Microsoft, and Amazon. I have not included answers of these questions, as you should try them first by yourself, if you are not able to solve, then just google it, you will see a lot of answers, approaches and hints for these interview questions. If you still unable to find answers then post as a comment and I will help you to find answers of these programming interview questions.

Here is my list of 20 common programming questions from Google, Amazon, Flipkart and other technical startups interviews. You might have seen them already but here they are again. If you don't know answers of all the questions then it's worth spending some time revising these vital questions.

1) Write code to reverse a linked list, if you able to do it using loops, try to solve with recursion.(solution)

2) How to rotate an array by K? (solution)

3) Given an array which contains N-2 numbers in unsorted order, find two missing numbers? (solution)

4) Given an array which has a number in the majority (a number appears more than 50% in the array), find that number? (solution)

5) How to detect a loop in singly linked list? If you are able to detect loop then find the size of linked list? (solution)

6) Given N steps to climb to reach a floor, a person can take 1 or 2 step at a time to climb. Find the number of ways to reach nth step? (discussion)

7) Design Snake and Ladder Game by using Object Oriented analysis and design technique. Explain the reasoning behind interface and class structure? (discussion)

8) How to merge two sorted linked list, write a program in your favorite programming language e.g. Java, C++, or Python.

9) Write a Program which checks if two Strings are Anagram or not? (solution)

10) How to print all permutations of a given String using recursion? (solution)

11) How to check if a binary tree is balanced or not? (solution)

12) How to swap two numbers without using a temp variable, write code which is free from Integer overflow? (solution)

13) How to find all pairs of elements in an integer array, whose sum is equal to a given number? (solution)

14) Write a program to check if a binary tree is BST or not? (solution)

15) Write a function to print nth number in Fibonacci series? (answer)

17) Write a function to count a total number of set bits in a 32 bit Integer? (solution)

18) Write code to implement an LRU cache? (solution)

19) Write a function to remove duplicate characters from String? (solution)

20) How to find the 3rd element from end, in a singly linked, in a single pass? (solution)

That's all guys, These are some of the most frequently asked programming questions in technical companies like Microsoft, Google, and Amazon, but it's not limited to them, many of them also appears in programming job interviews with other companies like Cognizant, Directi, Nomura or CTS. It's best to know and prepare these questions well in advance, with alternative solutions and BigO notation analysis. These are also good questions to share your programming skills.

If want to prepare interview topic wise e.g. array, string, data structure, design patterns, here are some more resources for you:
• Top 20 String based coding Interview questions (list)
• Top 30 Array coding interview questions (list)
• 20 Software design and design pattern Interview Questions (list)
• Top 15 Data Structure and Algorithm Interview Questions (list)
• 130+ Java Interview Questions with Answers (list)
• 10 Coding Questions from Programming Interviews (list)

Further Learning
Algorithms and Data Structures - Part 1 and 2
Java Fundamentals, Part 1 and 2
Cracking the Coding Interview - 189 Questions and Solutions

asgs said...

Thanks! These are like basic questions. I'm sure there are other Advanced questions asked by companies like Amazon.

Javin Paul said...

@asgs, yes Amazon and Google is famous for their much more tricky questions, but these are the most common ones you will often find, mostly on campus interviews on engineering colleges of India.

Anonymous said...

Can you please share Amazon Interview questions for software engineer and web development engineer position? It would be great if you could share both phone interview and onsite interview questions.