Upload Button Icon Add office photos

Filter interviews by

Whole Foods Market Software Developer Interview Questions and Answers

Be the first one to contribute and help others!

Interview questions from similar companies

I applied via Referral

Interview Questionnaire 

6 Questions

  • Q1. Design the most optimal data structures for an LRU cache
  • Ans. 

    Design optimal data structures for LRU cache

    • Use a doubly linked list to keep track of recently used items

    • Use a hash table to store key-value pairs for quick access

    • When an item is accessed, move it to the front of the linked list

    • When the cache is full, remove the least recently used item from the back of the linked list and hash table

  • Answered by AI
  • Q2. Convert a sorted array to balanced binary search tree
  • Ans. 

    Convert a sorted array to balanced binary search tree

    • Find the middle element of the array and make it the root of the tree

    • Recursively construct the left subtree using the left half of the array

    • Recursively construct the right subtree using the right half of the array

    • Repeat until all elements are added to the tree

  • Answered by AI
  • Q3. Reverse a singly linked list in groups of k in­place
  • Ans. 

    Reverse a singly linked list in groups of k in­place

    • Divide the linked list into groups of k nodes

    • Reverse each group of k nodes

    • Connect the reversed groups to form the final linked list

  • Answered by AI
  • Q4. Design the most optimal data structure for storing a word and its meaning. Note that a word could have multiple meanings
  • Q5. Write a recursive routine to calculate a ^ n
  • Ans. 

    A recursive routine to calculate a ^ n

    • The base case is when n is 0, in which case the result is 1

    • For any other value of n, the result is a multiplied by the result of a^(n-1)

    • The recursive function should call itself with a^(n-1) as the new input

  • Answered by AI
  • Q6. Design the most optimal data structure for a never ending stream of numbers. It should be optimized for insertion, deletion, searching, finding kth largest and kth smallest
  • Ans. 

    Design optimal data structure for never-ending stream of numbers for insertion, deletion, searching, kth largest and kth smallest.

    • Use a balanced binary search tree like AVL or Red-Black tree for efficient insertion, deletion, and searching.

    • Maintain two heaps, one for kth largest and one for kth smallest.

    • For finding kth largest, use a min heap of size k and for kth smallest, use a max heap of size k.

    • Alternatively, use a...

  • Answered by AI

Interview Preparation Tips

Skills:
College Name: NA

Skills evaluated in this interview

Interview Preparation Tips

Round: Test
Duration: 2 hours
Total Questions: 22

College Name: Jaypee University Of Information Technology, Solan

I appeared for an interview before Sep 2016.

Interview Questionnaire 

5 Questions

  • Q1. Search an element in sorted rotated array.
  • Ans. 

    Search an element in sorted rotated array.

    • Use binary search to find the pivot point where the array is rotated.

    • Divide the array into two subarrays and perform binary search on the appropriate subarray.

    • Handle the cases where the target element is at the pivot point or not present in the array.

  • Answered by AI
  • Q2. Kth largest element in an array.
  • Ans. 

    Find the Kth largest element in an array.

    • Sort the array in descending order and return the element at index K-1.

    • Use a max heap to find the Kth largest element efficiently.

    • Implement a quickselect algorithm to find the Kth largest element in linear time.

  • Answered by AI
  • Q3. Reverse a linked list in group of n element.
  • Ans. 

    Reverse a linked list in groups of n elements.

    • Divide the linked list into groups of n elements.

    • Reverse each group individually.

    • Connect the reversed groups to form the final linked list.

    • Handle cases where the number of elements is not a multiple of n.

    • Example: 1->2->3->4->5->6->7->8, n=3 -> 3->2->1->6->5->4->8->7

  • Answered by AI
  • Q4. Median of two sorted array.
  • Ans. 

    Find the median of two sorted arrays.

    • Merge the two arrays into one sorted array and find the median.

    • Use binary search to find the median in O(log(min(m, n))) time complexity.

    • Handle edge cases like empty arrays or arrays of different lengths.

  • Answered by AI
  • Q5. It was a DP question. In a matrix, I have to count number of paths from (0, 0) to (m, n) while crossing through some indexes were not allowed.
  • Ans. 

    Count number of paths from (0, 0) to (m, n) in a matrix while crossing through some indexes were not allowed.

    • Use dynamic programming to solve the problem

    • Create a 2D array to store the number of paths

    • Traverse the matrix and update the array based on the allowed paths

    • Return the value at the last index of the array

  • Answered by AI

Interview Preparation Tips

Round: Technical Interview
Experience: Interviewer was mainly focused on problem solving skill.

College Name: KIIT University

Skills evaluated in this interview

I appeared for an interview in Aug 2017.

Interview Preparation Tips

Round: Test
Experience: Platform: Hackerearth
20 MCQs with negative marking, topics included OS, DS-Algo, Networking.
2 Programming Problems.
Duration: 1 hour 30 minutes
Total Questions: 22

Round: Technical Interview
Experience: 3 DS-Algo problems were asked. Made to written codes on paper.

Round: Technical Interview
Experience: 2 DS-Algo problems were asked. Made to written codes on paper.
Few OS questions were also asked.

Skills: Data Structures and Algorithms, Operating Systems
College Name: IIT (BHU)

Software Developer Interview Questions & Answers

Amazon user image Pruthvi Perumalla

posted on 28 Aug 2015

I applied via Campus Placement

Interview Questionnaire 

4 Questions

  • Q1. Given a binary tree, build a doubly linked list for the leaves of the tree in the given order without using any extra space
  • Ans. 

    The question asks to convert the leaves of a binary tree into a doubly linked list without using extra space.

    • Traverse the binary tree in a depth-first manner

    • When a leaf node is encountered, update its left and right pointers to form the doubly linked list

    • Keep track of the previous leaf node to update its right pointer

    • Return the head of the doubly linked list

  • Answered by AI
  • Q2. Given a table m*n , find the number of ways of reaching from one corner to opposite corner, if a person can only move in two directions( towards the goal)
  • Ans. 

    Count number of ways to reach opposite corner of a m*n table moving in two directions only.

    • Use dynamic programming to solve the problem

    • The number of ways to reach a cell is the sum of the number of ways to reach the cell above it and the cell to the left of it

    • The number of ways to reach the opposite corner is the number of ways to reach the cell in the last row and last column

    • Example: For a 2*2 table, there are 2 ways ...

  • Answered by AI
  • Q3. A person can take one or two steps at a time. Find the number of ways in which n steps can be travelled
  • Ans. 

    The number of ways to travel n steps by taking one or two steps at a time.

    • This is a classic problem that can be solved using dynamic programming.

    • The number of ways to travel n steps is equal to the sum of the number of ways to travel n-1 steps and n-2 steps.

    • Use an array to store the number of ways for each step, starting with base cases for 0 and 1 steps.

    • Iterate through the array to calculate the number of ways for eac...

  • Answered by AI
  • Q4. Take a infix expression as input and print its postfix expression
  • Ans. 

    Convert infix expression to postfix expression.

    • Use a stack to keep track of operators.

    • Iterate through the infix expression and push operands to output.

    • If an operator is encountered, pop operators from stack until a lower precedence operator is found.

    • Push the operator to stack.

    • After iterating, pop remaining operators from stack and append to output.

    • Reverse the output to get postfix expression.

  • Answered by AI

Interview Preparation Tips

Round: Test
Experience: Multiple choice questions pretty much covered everything. This included details of big O notation , concepts from computer organisation etc . Be a little careful while writing outputs as there might be misleading options.
Duration: 90 minutes
Total Questions: 22

Round: Technical Interview
Experience: Building part was quite easy . Should have a little practice of writing code on paper.
Be careful about edge cases . The interviewer took it pretty seriously (things like root node should not be null)

Skills: Data Structures And Algorithms, C and one Object oriented language, Computer Organisation, Basic Aptitude topics like Combinatorics
Duration: 2 months
College Name: IIT Madras

Skills evaluated in this interview

Interview Questionnaire 

15 Questions

  • Q1. Reverse a binary search tree in such a manner so that parent child relationship maintained and left child become right child and vice versa
  • Ans. 

    Reverse a binary search tree while maintaining parent-child relationship.

    • Start by swapping the left and right child of each node recursively.

    • Use a depth-first search approach to traverse the tree.

    • Make sure to update the parent-child relationships accordingly.

  • Answered by AI
  • Q2. Find the minimum and maximum element in stack in O(1)
  • Ans. 

    To find min and max element in stack in O(1), we can use an auxiliary stack.

    • Create an auxiliary stack to keep track of the minimum and maximum elements.

    • Push the first element to both the main and auxiliary stack.

    • For each subsequent element, compare it with the top element of the auxiliary stack and push the smaller element to the auxiliary stack.

    • To get the minimum element, simply return the top element of the auxiliary...

  • Answered by AI
  • Q3. Given an array find the next minimum element in array for each element. for example if give array is 4,2,1,5,3 resultant array would be 2,1,-1,3,-1
  • Ans. 

    Given an array, find the next minimum element for each element.

    • Iterate through the array

    • For each element, compare it with the elements on its right

    • Find the minimum element greater than the current element

    • If no such element exists, assign -1

    • Build the resultant array

  • Answered by AI
  • Q4. Given two string A and B . remove each character from string A which occur in B. if a occur 2 times in B remove 2 a from A
  • Ans. 

    Remove characters from string A that appear in string B, considering their frequency in B.

    • Use a frequency counter for string B to track occurrences of each character.

    • Iterate through string A and build a new string excluding characters found in B.

    • Example: A = 'hello', B = 'l' -> Result: 'heo'.

    • Example: A = 'banana', B = 'an' -> Result: 'b'.

    • Consider edge cases like empty strings or no common characters.

  • Answered by AI
  • Q5. Find the median of input stream in minimum time complexcity.(Online algo)
  • Ans. 

    Find median of input stream in minimum time complexity using online algorithm.

    • Use two heaps, one max heap for elements smaller than current median and one min heap for elements greater than current median.

    • Maintain balance between the two heaps by ensuring that the size difference is at most 1.

    • If the size of both heaps is equal, median is the average of the top elements of both heaps. Else, median is the top element of ...

  • Answered by AI
  • Q6. Make copy of a linked list which has two pointer one point to next node and other one point to arbitrary node in linked list
  • Ans. 

    To make a copy of a linked list with two pointers, iterate through the original list and create a new node for each element.

    • Iterate through the original linked list

    • Create a new node for each element

    • Set the 'next' pointer of each new node

    • Set the 'arbitrary' pointer of each new node

  • Answered by AI
  • Q7. If u will access data from a social networking site such as Facebook . suggest some method to remove latency to access data
  • Ans. 

    Implementing caching, optimizing queries, and using CDNs can reduce latency when accessing data from social networking sites.

    • Use caching mechanisms like Redis or Memcached to store frequently accessed data.

    • Optimize database queries to reduce response time, e.g., using indexes.

    • Implement pagination to load data in chunks instead of all at once.

    • Utilize Content Delivery Networks (CDNs) to serve static assets closer to user...

  • Answered by AI
  • Q8. Given a cordinate system in which there are n points. you have to calculate the m minimum points from some origin point. Suggest a data structure for this
  • Ans. 

    Use a min-heap to efficiently find the m closest points to an origin in a coordinate system.

    • 1. Use a min-heap (priority queue) to store points based on their distance from the origin.

    • 2. Calculate the distance using the Euclidean formula: distance = sqrt((x2 - x1)^2 + (y2 - y1)^2).

    • 3. Insert points into the heap and maintain its size to m to keep only the closest points.

    • 4. Example: For points (1,2), (3,4), (5,6) and orig...

  • Answered by AI
  • Q9. Some question on hash data structure
  • Q10. Given a linked list and some no n . you have to reverse the node of linked list in pair of n. consider all test cases for this
  • Ans. 

    Reverse the nodes of a linked list in pairs of n

    • Iterate through the linked list in pairs of n

    • Reverse the nodes within each pair

    • Connect the reversed pairs together

    • Handle cases where the number of nodes is not a multiple of n

  • Answered by AI
  • Q11. Given a array where the difference between two consecutive element is one. Given a no find that no in array in minimum time complexity
  • Ans. 

    Find a number in a consecutive integer array using binary search for optimal time complexity.

    • The array is sorted and consists of consecutive integers, e.g., [1, 2, 3, 4, 5].

    • Use binary search to find the number in O(log n) time complexity.

    • Calculate the mid index and compare the middle element with the target.

    • If the target is less than the middle element, search the left half; otherwise, search the right half.

    • Example: To...

  • Answered by AI
  • Q12. How to check singly linked list is palindrome or not
  • Ans. 

    To check if a singly linked list is a palindrome, reverse the second half and compare it with the first half.

    • Traverse the linked list to find the middle node

    • Reverse the second half of the linked list

    • Compare the reversed second half with the first half to check for palindrome

  • Answered by AI
  • Q13. Given a preorder of binary tree such that in tree each node have either 0 or no childern. and each leaf node is represented by N. construct a tree from this
  • Ans. 

    Given a preorder of binary tree with leaf nodes represented by N, construct the tree.

    • Start by creating an empty stack.

    • Iterate through the preorder list.

    • If the current element is N, create a leaf node and push it onto the stack.

    • If the current element is not N, create a new node and set its left child to the top of the stack.

    • Pop the top of the stack and set it as the right child of the new node.

    • Push the new node onto the...

  • Answered by AI
  • Q14. 14. you have given a string of multiline. you have to print the maximum occupancy word in each line and if there is some capital letter in each line then print each capital letter occupancy and then smal...
  • Ans. 

    The question asks to find the maximum occupancy word in each line of a given multiline string and also count the occupancy of capital and small letters separately.

    • Split the multiline string into individual lines

    • For each line, split it into words

    • Initialize variables to store the maximum occupancy word and its count

    • Iterate through each word and count the occupancy of each letter

    • If the current word has a higher occupancy ...

  • Answered by AI
  • Q15. One question related to password matching you have given some precondition for password then user input some password then you will validate the password with each condition if any one condition failed th...
  • Ans. 

    Validate user passwords against predefined conditions to ensure security and compliance.

    • Password must be at least 8 characters long. Example: 'Password1' is valid, 'Pass' is invalid.

    • Password must contain at least one uppercase letter. Example: 'Password1' is valid, 'password1' is invalid.

    • Password must contain at least one lowercase letter. Example: 'Password1' is valid, 'PASSWORD1' is invalid.

    • Password must include at l...

  • Answered by AI

Interview Preparation Tips

College Name: NA

Skills evaluated in this interview

Interview Preparation Tips

Round: HR INTERVIEW
Experience: Tell me about yourself.Most challenging task.-----://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/

Small modification in it. Parenthesis pairs are given in a separate list. You have to optimize the problem by suggesting the method you will need to store the pairs.

Round: HR INTERVIEW
Experience: What is the angle between hour and minute hand at 12:15. I said 90’ but corrected myself immediately.So he told me the importance that for huge no of clients this small mistake can create a blunder.He asked me a scenario where I faced this thing and thereby improved the time complexity.Lot of behavioural questions like conflicts with manager, team collaboration etc.

Round: HR INTERVIEW
Experience: -----://stackoverflow.com/questions/20026243/find-2-missing-numbers-in-an-array-of-integers-with-two-missing-valuesHe asked me if have heard of nut and bolt problem. I didn’t so he moved to next question.Given an array. Find the maximum number of groups of size of 2 or 3 that can be formed such that sum of the numbers in group is divisible by 3. No number can be reused.

Round: TECHNICAL INTERVIEW
Experience: Convert an integer to its roman. He asked me to consider cases with integers containing 4 and 9. I didn’t understand properly.He asked me if I I did anything extraordinary apart from my daily work in the office and what challenges I faced -----/

He did not accept this solution and asked me to optimize. This round didn’t go well, so I was not selected.

General Tips: Tips:Solve all the data structures related problems from geeksforgeeks and start practicing to write perfect code for any problem.
College Name: NA

Interview Questionnaire 

23 Questions

  • Q1. 18 questions in 20 minutes (probability, Os ,DSA,c)
  • Q2. In second section 2 programming questions in 30 minutes.(Pruning a binary tree , Cutting a rod so that we can get optimal benefit )
  • Q3. Given array of stock prices get the date of selling and buying so that profit is maximum
  • Ans. 

    Algorithm to find the best buying and selling dates for maximum profit from given stock prices array.

    • Iterate through the array and keep track of minimum price and maximum profit.

    • If current price is less than minimum price, update minimum price.

    • If current price minus minimum price is greater than maximum profit, update maximum profit and buying and selling dates.

    • Return buying and selling dates.

    • Example: [10, 7, 5, 8, 11,...

  • Answered by AI
  • Q4. Print a matrix diagonally . I was told to write the code as question was quite easy . After that we moved on
  • Ans. 

    This task involves printing the elements of a matrix in a diagonal order, starting from the top-left corner.

    • Iterate through each diagonal starting from the first row and the first column.

    • For each diagonal, collect elements until you reach the bounds of the matrix.

    • Print the collected elements for each diagonal in order.

    • Example: For a 3x3 matrix [[1,2,3],[4,5,6],[7,8,9]], the output would be: 1, 2, 4, 3, 5, 7, 6, 8, 9.

  • Answered by AI
  • Q5. Frog can jump 1 or 2 steps write the code to find out number of ways to go up to n steps. Discussed the complexity of it with mathematical proof
  • Ans. 

    The code finds the number of ways to reach n steps by jumping 1 or 2 steps at a time.

    • Use dynamic programming to solve the problem

    • Create an array to store the number of ways to reach each step

    • Initialize the array with base cases for 0 and 1 steps

    • Iterate through the array and calculate the number of ways for each step

    • Return the value at the last step

  • Answered by AI
  • Q6. Check for balancing of parenthesis using divide and conquer. Didn’t ask for code just wanted the approach. I solved it with stack. But he just wanted Divide and conquer. After thinking for 15 minutes and o...
  • Ans. 

    Use divide and conquer to check for balanced parentheses by recursively splitting the string and validating each part.

    • Divide the string into two halves until each substring is of length 1 or 0.

    • Check the balance of each half recursively: count '(' and ')' in each half.

    • Combine results: ensure that the total count of '(' matches ')' and that no half has more ')' than '(' at any point.

  • Answered by AI
  • Q7. There is a dictionary of billion words and there is one method provided String getWord(int index); We can give it index and it will return the String on that index . Now word is given to us we have to find...
  • Ans. 

    To find the index of a word in a billion-word dictionary, use binary search for O(log n) efficiency.

    • Use binary search: Start with low = 0 and high = billion-1.

    • Calculate mid = (low + high) / 2 and compare getWord(mid) with the target word.

    • If getWord(mid) < target, search in the right half: low = mid + 1.

    • If getWord(mid) > target, search in the left half: high = mid - 1.

    • Repeat until low exceeds high or the word is f...

  • Answered by AI
  • Q8. After that he moved to Oops concepts asked about abstract classes and interfaces. Also asked when to use interfaces .After that we had discussion on volatile keyword(Asked for program which can show its be...
  • Q9. He told me if there is a class and if we want to use only 3 methods of it so in that case we should use inheritance or not. Asked for other better options
  • Ans. 

    Inheritance isn't always the best choice; consider composition or interfaces for better flexibility and maintainability.

    • Use composition: Create a new class that uses instances of the original class to access only the needed methods.

    • Example: If you need methods A, B, and C from Class X, create Class Y that has an instance of Class X and calls only A, B, and C.

    • Consider interfaces: Define an interface with the required me...

  • Answered by AI
  • Q10. Why are you leaving your company so early
  • Ans. 

    I'm seeking new challenges and opportunities for growth that align better with my career goals and aspirations.

    • Desire for professional growth: I want to expand my skill set and take on more responsibilities.

    • Cultural fit: I realized that the company's values and work environment don't align with my personal values.

    • Career advancement: I am looking for a position that offers clearer paths for advancement and development.

    • P...

  • Answered by AI
  • Q11. Discussion about project in company and about my college projects as well(It was a deep discussion and I think it can throw us out if we don’t give proper answers)
  • Q12. Replace each node in BST with sum of its greater nodes. I solved it quite easily after that he applied various constraints on it(around 3 or 4). So the problem became quite hard. But after thinking about ...
  • Ans. 

    Transform each node in a BST to the sum of all greater nodes, enhancing the tree's structure.

    • Traverse the BST in reverse in-order (right, root, left) to access nodes in descending order.

    • Maintain a running sum that accumulates the values of nodes visited.

    • Update each node's value with the current running sum before moving to the left child.

    • Example: For a BST with nodes 10, 5, 15, the transformation results in 25 (10 beco...

  • Answered by AI
  • Q13. After that he discussed about n-ary tree and getting the LCA in n-ary tree of n nodes.(Wrote the code for it and discussed complexity)
  • Ans. 

    Finding the Lowest Common Ancestor (LCA) in an n-ary tree involves traversing the tree to identify shared ancestors.

    • An n-ary tree is a tree data structure where each node can have at most n children.

    • To find the LCA of two nodes, traverse the tree and store the path from the root to each node.

    • Compare the paths to find the last common node.

    • Example: In a tree with root A, children B and C, and C has children D and E, LCA ...

  • Answered by AI
  • Q14. Advantages and disadvantages of amazon.com
  • Ans. 

    Amazon.com is an online retail giant with a vast selection of products and services.

    • Advantages: Wide selection of products, competitive pricing, fast shipping, convenient shopping experience

    • Disadvantages: Can put smaller retailers out of business, concerns over worker treatment and environmental impact

    • Example: Amazon Prime offers free two-day shipping and access to streaming services like Prime Video and Music

    • Example: ...

  • Answered by AI
  • Q15. How to make a file mutually exclusive on a shared file system
  • Ans. 

    Use file locking mechanisms like flock or lockfile to make a file mutually exclusive on a shared file system.

    • Use flock or lockfile to acquire a lock on the file before accessing it.

    • Release the lock once the operation is complete.

    • Ensure all processes accessing the file use the same locking mechanism.

    • Example: flock /path/to/file -c 'command to execute'

    • Example: lockfile /path/to/file && command to execute && rm -f /path/t...

  • Answered by AI
  • Q16. Tell me about yourself
  • Ans. 

    I am a software developer with 5 years of experience in developing web applications using Java and JavaScript.

    • 5 years of experience in software development

    • Proficient in Java and JavaScript

    • Developed web applications

    • Strong problem-solving skills

    • Experience with agile development methodologies

  • Answered by AI
  • Q17. Negative and positive things in you
  • Ans. 

    Positive: Strong problem-solving skills, Negative: Can be overly critical of own work

    • Positive: Strong problem-solving skills - I excel at breaking down complex problems and finding efficient solutions

    • Negative: Can be overly critical of own work - I tend to be perfectionistic and struggle with accepting imperfections

  • Answered by AI
  • Q18. Discussion about projects.(Deep discussion)
  • Q19. Tell me a situation in your current company when you had a failure in doing a task and What you learnt from it
  • Ans. 

    I had a failure in implementing a new feature due to a lack of understanding of the requirements.

    • I was assigned to develop a new feature for our software application.

    • I misunderstood the requirements and implemented the feature incorrectly.

    • During the testing phase, it was discovered that the feature was not functioning as expected.

    • I took responsibility for the mistake and immediately communicated it to my team lead.

    • I wo...

  • Answered by AI
  • Q20. Replace every element in array with its closest maximum element in right. As amortized analysis was involved he asked for mathematical proof
  • Ans. 

    Replace every element in array with its closest maximum element in right.

    • Iterate through the array from right to left

    • Keep track of the maximum element seen so far

    • Replace each element with the maximum element seen so far

  • Answered by AI
  • Q21. Asked to design distributed Hashtable . Discussed pros and cons
  • Ans. 

    Designing a distributed Hashtable and discussing its pros and cons.

    • Distributed Hashtable is a data structure that stores key-value pairs across multiple nodes.

    • Pros include scalability, fault tolerance, and load balancing.

    • Cons include increased complexity, potential for data inconsistency, and slower performance due to network communication.

    • Examples of distributed Hashtable implementations include Cassandra, Riak, and D...

  • Answered by AI
  • Q22. How will you resolve conflicts with your manager
  • Ans. 

    Resolving conflicts with a manager involves open communication, understanding perspectives, and finding common ground.

    • Practice active listening to understand your manager's viewpoint before responding.

    • Schedule a one-on-one meeting to discuss the conflict in a private setting.

    • Use 'I' statements to express how the situation affects you, e.g., 'I feel overwhelmed when deadlines change suddenly.'

    • Seek to understand the unde...

  • Answered by AI
  • Q23. How will you resolve conflicts with your team mates
  • Ans. 

    I prioritize open communication and collaboration to resolve conflicts effectively with my teammates.

    • Listen actively to understand the other person's perspective.

    • Use 'I' statements to express feelings without blaming others, e.g., 'I feel overwhelmed when deadlines are tight.'

    • Seek common ground by identifying shared goals, such as delivering a successful project.

    • Propose solutions collaboratively, encouraging input from...

  • Answered by AI

Interview Preparation Tips

Round: Technical Interview
Experience: After 2 days HR called me for 3 F2F interviews.

Round: Technical Interview
Experience: Given array of stock prices get the date of selling and buying so that profit is maximum.- Discussed various approaches Brute force ,Using heaps, Divide and conquer and optimal solution.
For each approach I wrote the code on white paper and they told to trace it out with example. I have to write production level code with all corner cases.

Round: Technical Interview
Experience: After one week HR called me that I have one more round with s/w developer manager so I went back to HYD.

Round: Technical Interview
Experience: After that I came back to Pune. I went through a lot of thinking.After two days I got a call from HR that feedback is very positive and all the interviewers want you in their team.  and I got an offer.

General Tips: I got interviewed for Amazon Hyderabad for SDE1 position . It was for e-commerce platform team.I want to share my experience so that it can help others. I have 7 months of experience but the vacancy was for 1+ year exp. Guys all the logistics were arranged by Amazon (Including flight tickets+Hotelstay+cab+lunch and dinner). It was an amazing experience.
Skills: Algorithm, Coding, probability
College Name: NA

Skills evaluated in this interview

Interview Questionnaire 

18 Questions

  • Q1. Tell me about yourself?
  • Ans. 

    I'm a passionate software developer with a strong background in full-stack development and a love for problem-solving.

    • Experience in developing web applications using React and Node.js.

    • Worked on a team project that improved application performance by 30%.

    • Strong understanding of algorithms and data structures, demonstrated through competitive programming.

    • Enjoy collaborating with cross-functional teams to deliver high-qua...

  • Answered by AI
  • Q2. DBMS project discussion
  • Q3. How to merge k sorted arrays of n length and discussion on its complexity?
  • Ans. 

    Merging k sorted arrays can be efficiently done using a min-heap to maintain order.

    • Use a min-heap (priority queue) to keep track of the smallest elements from each array.

    • Initialize the heap with the first element of each of the k arrays.

    • Extract the minimum element from the heap, and add it to the result array.

    • If the extracted element has a next element in its original array, push that next element into the heap.

    • Repeat ...

  • Answered by AI
  • Q4. A question on how to reach to the end of an array based on the values available in the array. Values determine the steps which can be taken forward. complete code for this?
  • Q5. How to identify that if a tree is a bst or not?
  • Ans. 

    To identify if a tree is a BST, check if the inorder traversal of the tree results in a sorted sequence.

    • Perform an inorder traversal of the tree

    • Check if the resulting sequence is sorted in ascending order

    • If yes, the tree is a BST; otherwise, it is not

  • Answered by AI
  • Q6. Discussion about the java project
  • Q7. Shortest path in maze and then discussion on it. Maze was modified into a n-dimension maze. complete code for 2-d maze
  • Q8. Favourite subject and what are you best at
  • Ans. 

    My favorite subject is computer science and I excel in problem-solving and algorithm design.

    • Computer science is my favorite subject because I enjoy coding and creating software applications.

    • I am best at problem-solving, as I have a strong analytical mindset and can efficiently break down complex issues.

    • I excel in algorithm design, as I have a deep understanding of data structures and can optimize code for efficiency.

  • Answered by AI
  • Q9. What is paging. what is virtual memory and discussion on why do we have virtual memory?
  • Ans. 

    Paging is a memory management technique used by operating systems to manage memory more efficiently. Virtual memory is a technique that allows a computer to use more memory than it physically has available.

    • Paging divides memory into fixed-size blocks called pages.

    • Virtual memory allows programs to use more memory than is physically available by temporarily transferring pages of data from RAM to disk.

    • Virtual memory also ...

  • Answered by AI
  • Q10. Inside a system with 4 gb ram OS only uses around 3.2 gb. Why is rest of the memory lying waste?
  • Ans. 

    The remaining memory is not wasted, but reserved for other system processes and applications.

    • The operating system reserves a portion of the RAM for its own processes and functions.

    • The unused memory can be used for caching data, improving system performance.

    • Applications and processes may not require the full amount of RAM at all times.

    • The unused memory can be allocated to other applications when needed.

    • Virtual memory an...

  • Answered by AI
  • Q11. A LONG discussion on implementing a T-9 dictionary in a mobile
  • Q12. An array is given which may be any of the 4 cases a.) completely increasing b.) completely decreasing c.) decreasing then increasing d.) increasing then decreasing. Find max in the array. o(log n) solutio...
  • Ans. 

    Find the maximum in an array with various orderings using O(log n) and O(1) solutions.

    • Use binary search for O(log n) solution in cases c and d.

    • For case a (completely increasing), return the last element as max.

    • For case b (completely decreasing), return the first element as max.

    • Example: For [1, 2, 3, 4], max is 4 (case a).

    • Example: For [4, 3, 2, 1], max is 4 (case b).

    • Example: For [5, 6, 7, 8, 7, 6], max is 8 (case c).

    • Exa...

  • Answered by AI
  • Q13. No of combinations of moves for knight in chess board are given return total possible positions
  • Ans. 

    Return the total possible positions for a knight on a chess board given the number of combinations of moves.

    • Calculate all possible positions for a knight on a chess board using its unique L-shaped moves.

    • Consider the boundaries of the chess board while calculating the positions.

    • The total possible positions for a knight on a chess board are 64.

  • Answered by AI
  • Q14. Again, Tell me about urself
  • Ans. 

    I'm a passionate software developer with a strong background in full-stack development and a love for solving complex problems.

    • Experience in JavaScript frameworks like React and Angular, building responsive web applications.

    • Proficient in backend development using Node.js and Express, creating RESTful APIs.

    • Worked on a team project that improved application performance by 30% through code optimization.

    • Strong understandin...

  • Answered by AI
  • Q15. Little discussion on intern project and then discussion on java project
  • Q16. Multiple requests for storing multiple files on a server. How to keep them mutually exclusive?
  • Ans. 

    Use file locking mechanism to ensure mutual exclusion.

    • Implement file locking mechanism to prevent simultaneous access to files.

    • Use semaphores or mutexes to ensure only one process can access a file at a time.

    • Implement a queue system to handle multiple requests and process them one by one.

    • Use transactional file systems to ensure atomicity of file operations.

    • Implement a timeout mechanism to prevent deadlocks.

    • Consider imp...

  • Answered by AI
  • Q17. Write COMPLETE code for implementing a hash table?
  • Q18. Given a bst. Replace the value in each node with sum of all the nodes which have values greater than the node itself
  • Ans. 

    The given question asks to replace the value in each node of a binary search tree with the sum of all nodes greater than the current node.

    • Traverse the BST in reverse order (right, root, left)

    • Keep track of the sum of all greater nodes encountered so far

    • Update the value of each node with the sum and update the sum

  • Answered by AI

Interview Preparation Tips

General Tips: That was pretty much the interview rounds. Best of luck.
Skills: Algorithm, data structure
College Name: MNIT Jaipur

Skills evaluated in this interview

Interview Questionnaire 

14 Questions

  • Q1. Find next inorder predecessor in bst?
  • Ans. 

    The next inorder predecessor in a binary search tree (BST) is the node with the largest value smaller than the given node.

    • In a BST, the inorder predecessor of a node is the rightmost node in its left subtree.

    • If the left subtree of the given node is empty, then the inorder predecessor is the nearest ancestor whose right child is also an ancestor of the given node.

    • If there is no inorder predecessor (i.e., the given node ...

  • Answered by AI
  • Q2. Given integer n. Generate all possible paranthesis
  • Ans. 

    Generate all possible parentheses for a given integer n.

    • Use recursion to generate all possible combinations of parentheses.

    • Start with an empty string and keep adding opening and closing parentheses.

    • Keep track of the number of opening and closing parentheses used.

    • Stop recursion when the number of opening and closing parentheses reaches n.

    • Add the generated combination to the result array.

  • Answered by AI
  • Q3. Given a linked list having next and random pointer(random pointer can point any where in the SLL node). Generate copy of this linked list
  • Ans. 

    Create a deep copy of a linked list with next and random pointers.

    • Traverse the original list and create a copy of each node.

    • Insert the copied nodes right next to the original nodes.

    • Set the random pointers of the copied nodes using the original nodes' random pointers.

    • Separate the copied list from the original list.

  • Answered by AI
  • Q4. Given a bt and a 2d matrix M. where M[i,j]=1 if i is ancessostor of j. Initially all elements of M is set to zero. Feed this matrix?
  • Ans. 

    The question asks how to feed a 2D matrix with values based on the given binary tree.

    • Traverse the binary tree and for each node, update the corresponding row in the matrix

    • Use a recursive function to update the matrix values

    • Start with the root node and recursively update its descendants

    • Set M[i, j] to 1 if node i is an ancestor of node j

    • Repeat the process for all nodes in the binary tree

  • Answered by AI
  • Q5. Given a sorted array(array can contain duplicates). Find the first occurance of given key elements in this array
  • Ans. 

    Find the first occurrence of a given key element in a sorted array with duplicates.

    • Use binary search to find the key element.

    • If the key element is found, check if it is the first occurrence by checking the previous element.

    • If the key element is not found, return -1.

  • Answered by AI
  • Q6. Now array is rotated..solve same
  • Ans. 

    Rotated arrays can be solved using binary search or linear search to find the minimum element or search for a target.

    • Identify the pivot point where the array is rotated. Example: [4, 5, 6, 7, 0, 1, 2] is rotated at index 3.

    • Use binary search to find the target efficiently. If the middle element is greater than the first element, search the left half.

    • If the middle element is less than the first element, search the right ...

  • Answered by AI
  • Q7. Spiral order traversal of bt
  • Ans. 

    Spiral order traversal of a binary tree

    • Use a stack and a queue to traverse the binary tree in a spiral order

    • Start with the root node and add it to the stack

    • While the stack is not empty, pop a node from the stack and add its children to the queue

    • If the stack is empty, swap the stack and queue

    • Repeat until both stack and queue are empty

  • Answered by AI
  • Q8. Given a road network of a city. Each road represents an edge and need atleast one guard at any end of the road to put it in observation. Derive a algorithm to deploy minimum guard s.t that each road have a...
  • Ans. 

    Deploy minimum guards on a city's road network ensuring each road has at least one guard at its ends.

    • Model the city as a graph where intersections are nodes and roads are edges.

    • Use a greedy algorithm to select nodes (intersections) to place guards.

    • A possible approach is to use a vertex cover algorithm, which finds the smallest set of vertices covering all edges.

    • For example, in a triangle graph with edges (1,2), (2,3), ...

  • Answered by AI
  • Q9. He asked me about my previous projects and how I approched them
  • Q10. Implement queue using stacks
  • Ans. 

    Queue can be implemented using two stacks by maintaining the order of elements.

    • Use two stacks, one for enqueue operation and one for dequeue operation

    • When enqueue is called, push the element onto the enqueue stack

    • When dequeue is called, if the dequeue stack is empty, transfer all elements from enqueue stack to dequeue stack

    • Pop the top element from the dequeue stack and return it as the dequeued element

  • Answered by AI
  • Q11. Edit distance problem (DP)
  • Ans. 

    Edit distance problem is a dynamic programming problem to find the minimum number of operations required to transform one string into another.

    • The problem can be solved using dynamic programming approach

    • The solution involves filling up a matrix of size (m+1)x(n+1)

    • The matrix represents the minimum number of operations required to transform one string into another

    • The operations include insertion, deletion and substitution

    • ...

  • Answered by AI
  • Q12. He asked me some simple c questions like memory allocation, dangling pointer, static etc
  • Q13. Related to projects
  • Q14. Find loop in linked list. Proof of algo
  • Ans. 

    To find a loop in a linked list, we can use the Floyd's cycle-finding algorithm.

    • Initialize two pointers, slow and fast, both pointing to the head of the linked list.

    • Move slow pointer by one step and fast pointer by two steps at each iteration.

    • If there is a loop, the slow and fast pointers will eventually meet.

    • To prove the algorithm, we can use mathematical induction and the concept of tortoise and hare.

  • Answered by AI

Interview Preparation Tips

General Tips: I am 2011 passed out from IIIT Hyderabad&#44; I would like to contribute for AmbitionBox by sharing my experience of Amazon Interview process. This was for a SDE position in Bangalore.I had one online test. After that 4 round of F2F interviews and I cracked it.
Skills: Algorithm, data structure
College Name: IIIT HYDERABAD

Skills evaluated in this interview

Tell us how to improve this page.

Compare Whole Foods Market with

Amazon

4.0
Compare

Mahindra & Mahindra

4.1
Compare

American Express

4.1
Compare

Sodexo

4.1
Compare
write
Share an Interview