MockQuestions

Amazon Software Developer
Interview Questions

21 Questions and Answers by
| William Swansen is an author, job search strategist and career advisor who assists individuals from all over the world.

Question 1 of 21

How do you approach implementing an LRU Cache in your favorite programming language?

1000s of Interview Questions

Win your next job by practicing from our question bank. We have thousands of questions and answers created by interview experts.

Software Developer Interview Questions

  1. 1.

    How do you approach implementing an LRU Cache in your favorite programming language?

      Having a favorite programming language tells a lot about the experience and expertise level of a software developer. There are numerous languages to pick from, and depending on what applications you are working on, and what you are intending to achieve, some might work better than others. The Amazon hiring manager might start with a question about what your favorite language is and then move to your approach and possibly your methodology or reasoning for favoring that language. Let me give an example of how this question might be answered. If we intend to use Java for this example, we would look at the LRU cache and recently used entries, then remove the element from the bottom and add an element to the start of a LinkedList; wherever any entry is accessed, it is moved to the top so that recently used entries will reside at the top, and the least used entries will reside on the bottom.

      William's Answer

      "The way I approach implementing an LRU Cache is really based on what programming language is used in the development environment. Yes, I do have a preference, but I consider it a tool in a toolbox. I use whatever is available to me, so I can easily adapt my process to the ones used here at Amazon. Java seems to be a tool of choice in most development environments, and for me as well. Say for example we are given total possible page numbers that can be referred. We are also given cache (or memory) size (number of page frames that the cache can hold at a given time). The LRU caching scheme is intended to remove the least recently used frame when the cache is full and thus a new page is referenced which was not in the cache before. Examples of this approach and method are referenced in the Galvin book."

  2. 2.

    Based on your experience, what's the best way to find a node that begins with two single link lists?

      You will find that Amazon interviewers like to ask candidates about the various methods they use to find nodes and link lists. Don't be surprised if this question comes up a couple of times in an interview but is asked in a different way. To get a broader understanding of linked lists, here's an overview: A linked list is easiest explained as a linear data structure with the collection of multiple nodes, where each element stores its own data and a pointer to the location of the next element. The last link is essentially a linked list that points to null, which indicates it's at the end of a chain. An element, on the other hand, in a linked list is called a node. The first of nodes is called the head, and the last of nodes is called the tail. An interviewer will likely dig into questions about linear data structure, and which nodes contain a value and pointer.

      William's Answer

      "The best example I can give is to list the most important properties of a class Linked List. This highlights how they are used and why they are used.

      A Linked List maintains an insertion order of the elements.
      Implements Queue and Deque interfaces. These can also be used as a Queue, Deque or Stack.
      A Linked List can contain all the elements, including but not limited to duplicates and null.
      A Java Linked List Class library is not synchronized, which means in a multi-threaded environment it must be synchronized concurrently for modifications to the linked list externally.
      A Linked List Class doesn't implement a Random Access interface, so elements can be accessed in sequential order.
      I can use a List Iterator to iterate elements of the list
      I can use a collections synchronized List (new Linked List) to get a synchronized linked list."

  3. 3.

    Making a comparison, how would you differentiate between Quality Assurance and Quality Control, as you believe it is implemented here at Amazon?

      Anyone in the quality field, be it Software (IT), Engineering, Production, etc. should be able to differentiate between the two. Depending on what specific role you have with a quality task, it will be wide-ranging. In order to help you understand the difference between the two, let me give you a better idea of what they actually are, and what they do. In short, Quality Assurance checks if proper processes are being followed, while Quality Control deals with maintaining the quality of a software product. If the Amazon hiring manager you are meeting with has any responsibility for QA or QC in their department, they will likely ask you to differentiate the two. Things that they might want to hear are things like.....

      Quality Assurance - Assures that the approach and/or method used to produce a part are designed and implemented correctly.

      Quality Control - A process used to test, verify and identify a defect. It also ensures that the approaches, techniques and methods are designed and followed correctly.

      William's Answer

      "Based on my research, I believe that here at Amazon, quality control and quality assurance work hand in hand in a software development environment. Every software development project that I have worked on required a detailed specification document that includes QA and QC as part of the (SDLC) Software Development Life Cycle.

      With Quality Assurance, I always perform the following (Prevent defects in development coding, apply statistical process controls, and define standards that need to be followed). As for Quality Control, I also always perform these tasks as well (Aim to identify and improve the quality of programming code, perform validation early in the development process, and follow pre-defined processes, policies, and standards)."

  4. 4.

    If hired by Amazon, one of your tasks will be to debug yours as well as other developers' code. As a software developer, explain the meaning of debugging, and why it's used?

      In the software debugging world, the process starts as soon as code is written and continues in successive stages of the development process, and is then combined with other units of programming to form a software product. Debugging is a multistep process that involves identifying a problem, isolating the source of the problem, and then correcting the problem. Please remember this since the Amazon technical manager that knows development and debugging well will quiz you on multiple facets of this area. It's really important to note that hiring managers will want to find out how good the quality of your code is. The reason is they will know how much time you will be spending on the debugging process. If you maintain a high-quality level of code, you'll be doing less debugging, if your code is average or not great, you'll be spending a lot more time debugging which managers might see as a weakness. Please be aware of this.

      William's Answer

      "In short, debugging is an important part of determining why an operating system, application, or program is behaving abnormally. When I do debugging, there are many things that I take into account during this process. For larger lines of code, I conduct unit testing and pair programming which helps me identify bugs at an earlier stage. I also use the stand-alone debugger tool to further identify bugs. I've always been conscious of my work and only want to produce top-quality work. To further understand where bugs may reside, I also look at the module to see if the problem avails itself. If not, I set up a 'breakpoint' and run a program to see it run its course. After performing debugging and testing, I do come across errors that I address and correct immediately. Some examples are...Syntax errors, Runtime errors, Logic errors, Semantic errors, etc. Does this mirror the process you use here at Amazon?"

  5. 5.

    Explain how duplicates are removed from an array without using a library?

      If we look at the core of this question, it has to do with an array not finding duplicates. The goal here is being able to remove duplicates from an integer array without using any collection API class libraries. There are several levels of interview questions that will come up to test your knowledge of basic to complex problem-solving solutions. This one sits somewhere in the middle of the pack. When an interviewer asks whether or not you need a loop or recursion, (depending on your skill level) she/he is asking the order in which elements are inserted in a set. Answering with something like 'An array is a static fixed-length structure that cannot change its length' is probably something that will tell the interviewer that you have a solid understanding of how deleting an array works.

      William's Answer

      "Having worked at many levels using arrays and class libraries, this is a pretty straightforward answer. If your input array contains multiple duplicates, then this may result in many temporary arrays and some of which may not be needed. With this restriction in mind, I typically figure out how to minimize both memory and hardware requirements. In cases where I need to delete an array using a more defined descriptive logic, the approach I take here is to find duplicate elements in a given array, then run an outer loop to 0 to size. As a next step in the process, I run another inner loop to find the first duplicate using another nested loop. To take it further, inside the inner loop I also check for duplicate elements. If I find one, then I delete the array element."

  6. 6.

    What method do you use to find the missing number in an integer array of 1 to 100?

      When it comes to interview questions about finding missing numbers in an integer, that tells me that the interviewer at Amazon has a specific type of role in mind for a candidate. More than likely, they are looking for someone who is an analytical thinker and can solve problems relatively easily. Let me demonstrate. Let's say I have an array number from 1 to 100. These are just random numbers for now. In a sorted array, you can compare whether a number is equal to the expected next number or not. Alternatively, you can also use the BitSet method in Java to solve this problem as well. A BitSet solution is more general, as you can use it to find more than one missing value on an integer array. Take your time to think about how you will respond to these types of questions because the interviewer is testing your ability to process and come up with an answer.

      William's Answer

      "Having many tools at my disposal, I find that a Java solution is the best way to solve this problem. I would typically write a program to find the missing number in an array in Java, C#, or another language. The method I use is to find missing elements in an area of 100 integers, which contains numbers between 1 and 100. Looking at this problem from a high level, this can easily be solved by calculating the sum of the series using n(n+1)/2, to solve this problem. It's a quick and efficient way to do it, but keep in mind that it cannot be used if the array contains more than one number or if the array contains duplicates. Some of these solutions might require you to calculate the sum of numbers and then subtract that from the actual sum to arrive at the correct answer. Is this similar to the methodology used here at Amazon?"

  7. 7.

    Here at Amazon, our developers work with Java quite a bit. Tell me how you find duplicate numbers in an array in Java containing multiple duplicates?

      You will find that Java is used with many applications, on many different platforms, and a multitude of languages as well. If you're in software development and haven't learned to program in Java, I suggest you learn it as soon as possible. It is becoming a core technology for web development and development in general. It has many capabilities that other programming tools don't have, and that's why it's been a favorite for many developers and companies such as Amazon. Everyone in IT has their own way of approaching a difficult problem and finding a solution. In this case, we're talking about finding duplicate numbers in an array in Java. Luckily, Java is a go-to for most developers trying to solve this problem. An interviewer might phrase this question in a few different ways, but this is the easiest to understand. When you hear the words Sorted or Binary search, this means that they are looking for you to explain what inner and outer loops mean, or parsing items inside an array. Be prepared for those questions as well.


      William's Answer

      "Problem-solving has always been a strength of mine. I take them on with the goal of finding a solution to a problem in the shortest time possible. In a recent project, I was working on a Java development project that required using Binary Search and Sorting. I started by adding a duplicate list of elements inserted back into an array. I also used two pointers to solve this, one to compare an element, and its closest neighbor to maintain a distinct element. Another method that I tried was by parsing all the items inside of an array containing 'n' to give me O(n). This way we get an array of the n+1 element with integers between 1 and 4, which means there will be at least one duplicate as a result."

  8. 8.

    How do you find the starting node of a cycle if a link contains a cycle?

      Let's say for argument's sake that two cyclists (no pun intended) are pointed at the beginning of the starting line with their cycles. For clarification purposes, the two cyclists are the pointers. In this example, if we move cyclist 1 a step at a time, and the second cyclist 2 steps at a time, they would eventually meet at a single point. What an interviewer wants to know is whether you can explain how you arrive at an answer and the reasoning behind your findings. This is important because when you explain if a link contains a cycle, you need to back that up with a verbal or written (whiteboard) example. A common response might be the mention of let's say that a meeting point is 'P' steps away from the beginning of the cycle, and the 'cyclists' meet when cyclist 1 has taken a '7' total steps toward the point.

      William's Answer

      "The way that I find a starting node of a cycle is I measure the length of 'R' and how far the distance is away from the cycle. That's a simple explanation. A more complex explanation I can illustrate is when cyclist 1 travels double the speed of cyclist 2, they both arrive at the same meeting point when time is constant. Since there are several examples I can give to make my point, I would like to share one more. The next pointer of each node that is traversed is made to point to this temporary node. This way we are using the next pointer of a node as a flag to indicate whether the node has been traversed or not. If I come across a node that points to null, then the loop doesn't exist. If I find that the code runs in O(n) time complexity and uses constant memory space, then that tells me that this needs to be researched further."

  9. 9.

    What is your experience with implementing a Binary Search Algorithm without recursion?

      This is the type of question an interviewer will ask if he starts to doubt your ability to perform certain duties revolving around algorithm-based development. Since software development at some level relies on algorithms and data structures, this will be an important question that you must understand and answer properly. If we look at how the binary search structure is broken down, it contains a binary search or half-interval search, which is a divide and conquer algorithm that seeks a position of an item in a sorted array. When a hiring manager asks about comparing inputs and output to the middle element of an array, they are asking if a search returns the position of an element. It's important to know and understand this concept. Another question that may be asked is whether or not an input is less than or greater than an element. If you have a sound understanding of these concepts, ask the interviewer what level of detail you would like to answer their question. Some interviewers only want to hear a high-level answer, and others want a detailed explanation.

      William's Answer

      "I have extensive experience and hands-on knowledge implementing binary search algorithms with and without recursion. For this answer, I will talk about BSA without recursion. Binary search algorithms typically halve the number of items checked for each successive iteration, thus locating the given item in logarithmic time. Furthermore, a Binary Search Implementation in a Java algorithm is implemented recursively respectively. Also, an interesting fact I would like to share is that binary search algorithm implementation is mostly done without recursion. It is also known as iterative binary search."

  10. 10.

    Can you walk me through the meaning behind a Depth First Search Algorithm for a binary tree?

      When looking at a question of this magnitude, there are a number of different factors to consider. You will want to get clarification from the Amazon interviewer on whether they want to hear the meaning for tree structure data, time complexity, extra space, or a node stack. Let's examine what some of these mean and how they might come up in the course of an interview. Time Complexity - has four transversals O(n) as they visit every node exactly once. Extra Space - requires O(w) Level Order Transversal where w is the maximum width of a Binary Tree which stores nodes of different levels. Interview-related questions might look something like.....what are typical binary tree numbers? 1, 3, 7, 15 or in a worst-case scenario a value of 2h is Ceil(n/2) will usually come up as good answers to this question. A couple more that might come are when is extra space required for Level Order Transversal and Depth First Transversal? Two good responses can be a more balanced position for Level Order Transversal and a less balanced position for Depth First Transversal.

      William's Answer

      "I'm familiar with the meaning of this question. There are a couple of ways to answer it, so I will give you both examples. The two most common methods of searching a graph or a tree related to a depth-first search are depth-first search and breadth-first search for starters. Depending on the application you are using and the result you want to achieve, this should be determined by the type of data that is contained in your tree or graph data structure. For a Breath First Search, I start at the root node. I then search all their children nodes moving from left to right, then I repeat the process at the level below the root node. I typically repeat this again on each level until I reach the end of the tree or node. As a general practice, I use a queue as an intermediary step as a way of keeping track of what nodes I need to search."

  11. 11.

    Describe how do you implement an insertion sort algorithm, and what's the easiest way to do it?

      If the Amazon interviewer asks ten software developers to describe how to implement a sort algorithm, they will probably get 10 slightly different but related answers. Every software developer has a method and a work style of their own that works for them and makes them efficient at their job. An interviewer, in this case, wants to hear about the method you use and if you take any shortcuts to arrive at the final product. They want to know if you take shortcuts that could compromise the quality of work you are doing. They would like to hear about your development methodology and how you implement an insertion sort algorithm while doing your due diligence and quality checks along the way. In simple terms, the way an insertion sort works is it starts from the index 1 (not 0), and each index starting from index 1 is like a new card, that you have to place at the right position in a sorted sub-array on the left side.

      William's Answer

      "I can give several examples of Insertion Sorts, but I think to give you a better explanation, it would make more sense to list in detail the characteristics of an Insertion Sort. Let's start with the first one.

      1. There are two types.........Selection Sort and Bubble Sort algorithms.
      2. They are efficient for smaller data sets but very inefficient for larger data lists.
      3. The stable sorting technique does not change the relative order of elements that are equal.
      4. It doesn't take up much space. Unlike bubble sort, an insertion sort also requires additional memory space.
      5. An Insertion Sort is adaptive, which means it reduces the total number of steps required for a partially sorted array to provide input."

  12. 12.

    Amazon software developers use a variety of different sorting algorithms. Tell me the difference between a Comparison and Non-Comparison Sorting Algorithm?

      This is actually a common Amazon interview question asked of software developers. Which sorting algorithm is fastest? This question, believe it or not, doesn't have an easy or unambiguous answer. On one hand, the speed of sorting can depend on the environment, in which the sorting is done, and on the other hand, it can depend on the type of items that are sorted and the distribution of these particular items. For example, if you are sorting a large database that cannot fit into memory all at once, this would be quite different from sorting an array of 100 integers. Adding to that, not only will the implementation of an algorithm be quite different, but it may even be that same algorithm. It might also help to know the five Sorts that will likely be brought up in an interview. They are: Quick Sort, Insertion Sort, Shell Sort, Heap Sort, and Merge Sort. Study them and research examples of how they are used and the differences between them. I will give examples that you can use here as well.

      William's Answer

      "One of the first things that I do before making any type of comparison is to use a test environment to test the speed of the different sorting algorithms (Comparison and Non-Comparison) in this case. I test each algorithm several times for randomly generated arrays to gather the most accurate data before I proceed to the next step in the process. The next step is to look for random numbers between 0 and 10 times the array size so I can create array content. I may or may not do a high-repetition test with numbers between 0 and 1/100 times in the same context as well. After I do this, the results may come back as completely random, sorted, or reversed. I would also run some test-cases to determine the number of repetitions from low to high for each value, if the array repeats."

  13. 13.

    Can you list for me the important categories of software development?

      Believe it or not, the world of software development is an important part of our daily lives. Without it, we wouldn't have all the wonderful Amazon apps and mobile technologies that we use on a daily basis. Not only is software development important in our lives, but it is a highly sought-after skill for companies that can't find enough of this type of talent. Speaking of in-demand occupations, the Bureau of Labor Statistics even projected a 30% employment growth in the software development field by 2026. Let's talk about some questions that may come up in an interview. Many Amazon hiring managers like to test software developers by asking what type or category of software development they have worked on. Software developers will tend to work in special development areas where they have a comfort level. Most software developers should know what the 9 basic types of software development are even if they haven't worked directly in that category. For reference purposes and preparation, here are 9 different types of software development:

      1. Mobile Development
      2. Web Development
      3. Back-End Development
      4. Application Development
      5. Data Science Development (Data Analytics)
      6. API Development
      7. Security Software Development
      8. Embedded Systems Development
      9. Cloud Computing Development


      William's Answer

      "I'm quite familiar with all the categories of software development, especially those used here at Amazon, and have coded in most of them with a high level of confidence. The projects I have worked on have been Web Development - building front-end web pages in Java, WordPress, HTML, PHP, and ASP .NET. Mobile Development - building web apps on HTML5, Java, C# and Objective C. Application Development - typical app dev with tools like VB.NET, Python, C++, C# and Java. Data Science Development (Data Analytics) - This is a fun one for me. I've been building intelligent data warehouses and data sets for scientific applications using tools like MATLAB, Python, and C++. Back-end Development - this type of work is mostly server-side database-driven development which requires different programming languages and architecture. Some of the development tools I have used here are dBase, Oracle, SQL Server, Java, Python and C++."

  14. 14.

    At a high level, describe what the software development life cycle process is.

      SDLC, or Software Development Life Cycle, is a software development process that produces software in the most efficient way possible. SDLC includes a detailed plan for how a software application is to be developed, altered, maintained, or even replaced. SDLC involves several distinct stages, which include planning, design, building, testing, and deployment. Depending on what level hiring manager you are interviewing with, you'll need to be able to answer questions related to the SDLC life cycle. If the manager is hands-on, has a history of writing code, and knows the SDLC, then you might want to mention what types of methodologies you have used. Some of the most popular ones are Waterfall, Agile, and Spiral Model. If you're interviewing with a senior-level manager who hasn't done much coding but understands the SDLC, then your answer might be a higher level (strategic response). Either way, it's good to have a solid foundation of how SDLC works. The whole purpose of creating the SDLC foundational architecture is to lower the cost of software development while improving quality and shortening production time.


      William's Answer

      "I have sound knowledge of the entire SDLC process and have used it as the foundation of my development in my career. During my development career, I used a few different SDLC methodologies that I am very comfortable with. They are Waterfall, Agile, V-Model, Iterative, and Spiral Model. Not only do I fully understand SDLC, but the important stages that are required for quality software development and execution. It starts with the following stages:

      Requirement analysis
      Technical and business specifications
      Software architecture and infrastructure
      Implementation/Integration
      Testing
      Documentation
      Training and support
      Maintenance"

  15. 15.

    What is verification and validation, and why it is important?

      Verification and validation are extremely important in the software development process. If you can't verify or validate a set of activities to ensure that the software is not implemented correctly, hasn't been built to specification, or is functioning properly, then you will surely have problems with your production environment. Amazon interviewers know how important this is, and will ask questions about it to make sure that you have a practice of doing your due diligence to ensure the highest quality software development. When questions come up about verification and validation, it might score you an extra point in the interview if you give the Amazon interviewer a history of how V&V was formed. It is actually an application of Six Sigma and its principles. It was used to design products in the manufacturing and support process areas. It's important to remember, if asked, that there are two important aspects of software quality management. Verification gives the answer to the question of whether the software is being developed correctly, and validation provides the answer to whether the right software is being produced.

      William's Answer

      "In my opinion, verification and validation are at the heart of every development project. I take this step very seriously, and it shows in my work. This, of course, includes all the steps and procedures of validation. Prospective validation is important because it is done to ensure the product is functioning properly. Retrospective validation is done against the written specifications and verifies actual data. Periodic validation is used to repair, relocate or dismiss data that serves no purpose. Partial validation is mostly used for research but can come in handy for pilot studies. Cross-validation is suitable for estimating the performance of statistical models. Concurrent validation is usually carried out during regular maintenance or service routines in the post-development process."

  16. 16.

    Do you have a preferred language that you like to write programming algorithms?

      View All 21 Amazon Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  17. 17.

    What is software scope, and what does the process involve?

      View All 21 Amazon Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  18. 18.

    How would you define software configuration management?

      View All 21 Amazon Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  19. 19.

    Prior to starting any software development project here at Amazon, we perform a feasibility study. What is your opinion on a feasibility study, and when should it be done?

      View All 21 Amazon Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  20. 20.

    As part of software development, were you involved with working on functional and non-functional requirements?

      View All 21 Amazon Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  21. 21.

    Talk about the differences between structured English and Pseudo Code?

      View All 21 Amazon Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.