Add office photos
Engaged Employer

Amazon

4.1
based on 23.9k Reviews
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by

Malabar Group Of Companies Interview Questions and Answers

Updated 4 Nov 2024
Popular Designations

Q1. Find the square root of a number using only 4 basic arithmetic operations (+,-,*,/) without using a power operator and inbuilt libraries. For numbers that are not perfect squares, print the integer part of the ...

read more
Ans.

Find square root of a number using basic arithmetic operations without power operator and inbuilt libraries.

  • Use binary search to find the integer part of the square root

  • Use long division method to find the decimal part of the square root

  • Repeat the above steps until desired accuracy is achieved

  • Handle edge cases like negative numbers and numbers less than 1

Add your answer

Q2. Addition of two linked lists, and finallt return the result as a linked list

Ans.

Addition of two linked lists and return the result as a linked list.

  • Traverse both linked lists simultaneously

  • Add corresponding nodes and carry over the sum

  • Create a new linked list with the sum

Add your answer

Q3. Find leaf nodes in a binary tree ,followed by printing path to leaf nodes.

Ans.

Find leaf nodes in a binary tree and print path to each leaf node.

  • Traverse the binary tree using depth-first search (DFS)

  • When reaching a leaf node, store the path from root to that leaf node

  • Repeat the process for all leaf nodes in the tree

Add your answer

Q4. Deepest left node in binary tree

Ans.

Find the deepest left node in a binary tree.

  • Traverse the tree recursively and keep track of the depth and whether the current node is a left node.

  • If the current node is a leaf node and its depth is greater than the deepest left node found so far, update the deepest left node.

  • Return the deepest left node found.

  • Example: For the binary tree with root node 1, left child 2, and left child of 2 being 4, the deepest left node is 4.

  • Example: For the binary tree with root node 1, left ...read more

Add your answer
Discover Malabar Group Of Companies interview dos and don'ts from real experiences

Q5. Count occurrences in sorted array

Ans.

Count occurrences of a given element in a sorted array.

  • Use binary search to find the first and last occurrence of the element.

  • Subtract the indices to get the count.

  • Handle edge cases like element not present in the array.

Add your answer

Q6. Implement Min-stack using O(N) space .

Ans.

Min-stack is implemented using O(N) space by keeping track of minimum value at each element.

  • Use two stacks - one to store the actual elements and another to store the minimum value at each step.

  • When pushing an element, check if it is smaller than the current minimum and update the minimum stack accordingly.

  • When popping an element, also pop from the minimum stack if the popped element is the current minimum.

Add your answer

Q7. Implementation of Min Stack

Ans.

Implement a stack that supports push, pop, top, and retrieving the minimum element in constant time.

  • Use two stacks - one to store the actual elements and another to store the minimum values.

  • When pushing an element, check if it is smaller than the current minimum and push it to the min stack if so.

  • When popping an element, check if it is the current minimum and pop from the min stack if so.

  • Top operation can be implemented by returning the top element of the main stack.

  • GetMin op...read more

Add your answer

Q8. Sliding Window Problem.

Ans.

Sliding Window Problem involves finding a subarray of fixed size k with the maximum sum.

  • Use a sliding window approach to iterate through the array and keep track of the sum of elements within the window.

  • Slide the window by removing the first element and adding the next element in each iteration.

  • Keep track of the maximum sum found so far and update it if a new maximum is found.

Add your answer

More about working at Amazon

Top Rated Mega Company - 2024
Top Rated Company for Women - 2024
Top Rated Internet/Product Company - 2024
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Malabar Group Of Companies

based on 9 interviews in the last 1 year
3 Interview rounds
Coding Test Round 1
Coding Test Round 2
Technical Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter