Add office photos
Engaged Employer

Amazon

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

600+ Kangeya Labs Interview Questions and Answers

Updated 31 Dec 2024
Popular Designations
Q201. Find pair with maximum GCD in an array

You are given an array of positive integers. Find the GCD(Greatest Common Divisor) of a pair of elements such that it is maximum among all possible pairs. GCD(a, b) is the ...read more

View 3 more answers
Q202. Sorted Linked List to Balanced BST

You have been given a singly linked list in which nodes are present in increasing order. Your task is to construct a Balanced Binary Search Tree with the same data elements as ...read more

View 3 more answers
Q203. Snake and Ladder

You have been given a Snake and Ladder Board with 'N' rows and 'N' columns with the numbers written from 1 to (N*N) starting from the bottom left of the board, and alternating direction each row...read more

Add your answer
Q204. Maximum Sum of nodes in a binary tree such that no two nodes are adjacent

You have been given a binary tree with an integer value associated to each node. You are supposed to choose a subset of these nodes such ...read more

View 2 more answers
Discover Kangeya Labs interview dos and don'ts from real experiences
Q205. Majority element

You have been given an array/list 'ARR' consisting of 'N' integers. Your task is to find the majority element in the array. If there is no majority element present, print -1.

Note:
A majority el...read more
View 4 more answers
Q206. Bridges in a Graph

Given an undirected graph of V vertices and E edges. Your task is to find all the bridges in the given undirected graph. A bridge in any graph is defined as an edge which, when removed, makes...read more

View 3 more answers
Are these interview questions helpful?
Q207. Prerequisite Task

You are given a positive integer ‘N’ denoting the number of tasks you need to finish. You can directly start performing any task, but some tasks have some prerequisites, i.e. to perform some ta...read more

View 3 more answers
Q208. Convert Bst To The Greater Sum Tree

You have been given a Binary Search Tree of integers. You are supposed to convert it to a greater sum tree such that the value of every node in the given BST is replaced with ...read more

View 3 more answers
Share interview questions and help millions of jobseekers 🌟
Q209. Subarray with equal occurrences

You have been given an array/list ARR of length N consisting of 0s and 1s only. Your task is to find the number of subarrays(non-empty) in which the number of 0s and 1s are equal....read more

View 3 more answers
Q210. Distance between nodes of a binary tree

Given a binary tree and the value of two nodes, find the distance between the given two nodes of the Binary Tree.

Distance between two nodes is defined as the minimum numb...read more

View 3 more answers
Q211. Time to Burn Tree

You have been given a binary tree of 'N' unique nodes and a Start node from where the tree will start to burn. Given that the Start node will always exist in the tree, your task is to print the...read more

View 3 more answers

Q212. Given an Infix expression, how to evaluate its answer

Ans.

Infix expression can be evaluated using the concept of operator precedence and associativity.

  • Convert the infix expression to postfix expression using stack data structure

  • Evaluate the postfix expression using stack data structure

  • Use operator precedence and associativity rules to determine the order of evaluation

  • Parentheses can be used to override the default order of evaluation

Add your answer
Q213. Number of Islands

You have been given a non-empty grid consisting of only 0s and 1s. You have to find the number of islands in the given grid.

An island is a group of 1s (representing land) connected horizontall...read more

View 2 more answers
Q214. Longest Consecutive Sequence

You are given an unsorted array/list 'ARR' of 'N' integers. Your task is to return the length of the longest consecutive sequence.

The consecutive sequence is in the form ['NUM', 'NU...read more

View 3 more answers
Q215. Missing Number

You are given an array/list ‘BINARYNUMS’ that consists of ‘N’ distinct strings which represent all integers from 0 to N in binary representation except one integer. This integer between 0 to ‘N’ w...read more

View 4 more answers
Q216. Data Structure Supporting Insert Delete And GetRandom

Design and implement a data structure which supports the following operations:

insert(X): Inserts an element X in the data structure and returns true if the ...read more
View 2 more answers
Q217. Transform BST to greater sum tree

You have been given a Binary Search Tree of integers. You are supposed to convert it to a greater sum tree such that the value of every node in the given BST is replaced with th...read more

View 3 more answers
Q218. Power Set

You are given a sorted array of 'N' integers. You have to generate the power set for this array where each subset of this power set is individually sorted.

A set is a well-defined collection of distinc...read more

View 3 more answers
Q219. First negative integer in every window of size “k”

You have been given an array of integers 'ARR' and an integer ‘K’. You need to find the first negative integer in each window of size ‘K’.

Note :
If a window do...read more
View 2 more answers
Q220. Count Set Bits

You are given a positive integer ‘N’. Your task is to find the total number of ‘1’ in the binary representation of all the numbers from 1 to N.

Since the count of ‘1’ can be huge, you are required...read more

View 2 more answers
Q221. Fishmonger

A fishmonger wants to bring his goods from port to the market. On his route, he has to traverse an area with many states. He has to pay a toll at each border.

He is a good businessman. He wants to cho...read more

View 2 more answers
Q222. Check whether second string can be formed from characters of first string

You are given two strings STR1 and STR2. You need to check whether STR2 can be formed from the characters of STR1. Both the strings can ...read more

View 2 more answers
Q223. Next Smaller Element

You are given an array 'ARR' of integers of length N. Your task is to find the next smaller element for each of the array elements.

Next Smaller Element for an array element is the first ele...read more

View 2 more answers
Q224. Alien Dictionary.

You have been given a sorted (lexical order) dictionary of an alien language. Write a function that finds the order of characters in the alien language. This dictionary will be given to you in ...read more

View 3 more answers
Q225. Course Schedule

You are a student of Netaji Subhas Institute of Technology. You have to take ‘N’ number of courses labelled from 1 to N to complete your B.Tech Degree.

Some courses may have prerequisites, for ex...read more

View 2 more answers
Q226. Longest Path

You are given a Directed Acyclic Graph (DAG) with ‘E’ edges and ‘V’ vertices. A DAG is a type of graph with no directed cycles.

You have been given a source vertex ‘S’. Your task is to find the dist...read more

View 3 more answers
Q227. Delete mid element from stack

You are having a stack "ARR" of size 'N+1', your task is to delete the middlemost element so that the size of resulting stack is 'N'.

A stack is a linear data structure where both i...read more

View 3 more answers
Q228. Postorder Traversal

You are given the root node of a binary tree consisting of ‘N’ nodes. Your task is to return its postorder traversal. The postorder traversal of a binary tree is defined as a process of trav...read more

View 2 more answers
Q229. Langford pairing

You are given a positive integer N. Return a list of integers of size 2N containing all the integers from 1 to N (both inclusive) twice arranged according to Langford pairing. If no such pairing...read more

View 2 more answers

Q230. How to implement word suggestions like that in Eclipse

Ans.

Word suggestions in Eclipse can be implemented using algorithms like Trie or N-gram models.

  • Use Trie data structure to store the dictionary of words

  • Implement auto-complete feature using Trie

  • Use N-gram models to suggest words based on context

  • Train the N-gram model on a large corpus of text data

  • Combine both approaches for better accuracy

  • Consider user's typing speed and frequency of words for better suggestions

Add your answer
Q231. Why do we need dispatchers in short term scheduling?
Add your answer
Q232. Which is the best scheduling algorithms that you know?
Add your answer
Q233. DBMS Questions

What is ACID, explain with examples. Questions on join queries.

Add your answer
Q234. Rotated Array

You're given a sorted array that has now been rotated 'K' times, which is unknown to you. Rotation here means that every element is shifted from its position to right in each rotation and the last ...read more

View 2 more answers
Q235. Segregate even and odd nodes in a Linked List

You are given the head node of a singly linked list ‘head’. Your task is to modify the linked list in such a way that all the even valued nodes appear before the all...read more

View 2 more answers
Q236. Split the given array into K sub-arrays

You’re given an array/lits 'ARR' of size 'N' and an integer 'K'. Your task is to split 'ARR' into 'K' sub-arrays such that the maximum sum achieved from the 'K' subarrays ...read more

View 3 more answers
Q237. Javascript Questions

What is javascript, its uses, server client problems.

Add your answer
Q238. Height of the Binary Tree

You have been given the Inorder Traversal and Level Order Traversal of a Binary Tree of integers. Your task is to calculate the height of the Binary tree without constructing it.

The he...read more

View 2 more answers
Q239. Kevin and his Fruits

Kevin has ‘N’ buckets each consisting of some fruits. Kevin wants to eat at least ‘M’ fruits and so, he decided to set a marker (integer) as maximum as possible such that if he eats “number ...read more

View 2 more answers
Q240. Josephus

‘N’ people are standing in a circle numbered from ‘1’ to ‘N’ in clockwise order. First, the person numbered 1 will proceed in a clockwise direction and will skip K-1 persons including itself and will ki...read more

View 2 more answers
Q241. Check if two trees are Mirror

You are given two arbitrary binary trees consisting of N and M number of nodes respectively, your task is to check whether the two trees are mirror of each other or not.

Two trees a...read more

View 2 more answers
Q242. Sub Matrices With Sum Zero.

You’re given a square matrix 'MAT' of order N. Your task is to find the number of non-empty sub-matrices such that the sum of all the elements inside the submatrix is zero.

NOTE:

1. T...read more
View 2 more answers
Q243. Communication Test

Checking the basic communtication skills and confidence.

View 2 more answers
Q244. Max Submatrix

Ninja has been given a matrix ‘MAT’ of integers having size ‘N’ x ‘M’ i.e. N rows and M columns. Ninja has to find the maximum sum submatrix in it. In other words, he has to find the maximum sum ov...read more

View 2 more answers

Q245. Wich programming languages do you use in your work

Ans.

I primarily use Java and Python in my work as a Customer Service Associate.

  • I use Java for developing and maintaining our internal tools and systems.

  • I use Python for data analysis and automation tasks.

  • I also have experience with SQL for querying databases.

  • Additionally, I have some knowledge of HTML, CSS, and JavaScript for troubleshooting website issues.

View 13 more answers
Q246. N queens

You are given an integer 'N'. For a given 'N' x 'N' chessboard, find a way to place 'N' queens such that no queen can attack any other queen on the chessboard.

A queen can be killed when it lies in the ...read more

View 2 more answers
Q247. Maximal AND Subsequences

You are given an array consisting of N integers. You need to find the number of k-element subsequences of the given array where the bitwise AND of the subsequence's elements is maximal. ...read more

View 2 more answers
Q248. Longest Unique Substring

You are given a string 'Str' consisting of 'N' lowercase Latin letters. You have to find the longest substring of the given string without repeating characters.

String ‘B’ is a substrin...read more

View 3 more answers
Q249. Minimum Cost to Buy Oranges

You are given a bag of size 'W' kg and provided with the costs of packets with different weights of oranges as a list/array with the name 'cost'. Every i-th position in the cost denot...read more

View 6 more answers

Q250. What is customer service, how do we deal with customer service

Ans.

Customer service is the assistance and support provided to customers before, during, and after a purchase or interaction.

  • Customer service involves addressing customer inquiries, concerns, and complaints.

  • It includes providing information, resolving issues, and ensuring customer satisfaction.

  • Effective communication, empathy, and problem-solving skills are essential in customer service.

  • Examples of customer service include answering phone calls, responding to emails, and assistin...read more

View 8 more answers
Q251. Technical Questions

One of my projects involved managing a site, so he asked me, how would I handle if my site got huge traffic and I had to manage a lot of data, I told him how I’ll manage the database using i...read more

Add your answer
Q252. Minimum steps to reach target by a Knight

You have been given a square chessboard of size ‘N x N’. The position coordinates of the Knight and the position coordinates of the target are also given.

Your task is t...read more

View 2 more answers
Q253. Construct a strict binary tree

You have been given an array/list of integers, let’s say ‘PRE’, which represents the preorder traversal of a strict binary tree and an array/list ‘TYPENL’ which has only two possi...read more

View 2 more answers
Q254. Battalions and tanks

Let there be ‘N’ battalions of soldiers and ‘M’ tanks. You are also given an array/list of length ‘N’ whose i-th index denotes the number of soldiers in the i-th battalion. You are supposed ...read more

View 2 more answers
Q255. Search In Rotated Sorted Array

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4,...read more

View 2 more answers
Q256. Minimum Cost to Destination

You have given a m*n matrix filled with "1" and "0"."1" means you can use the cell and "0" means the cell is blocked. You can move in 4 directions left, right, top, bottom. Every time...read more

View 5 more answers

Q257. There is a big file containing numbers and we have to sort all of them

Ans.

We can use any sorting algorithm like quicksort, mergesort, heapsort, etc.

  • Choose the appropriate sorting algorithm based on the size of the file and the range of numbers

  • Implement the chosen algorithm in the programming language of choice

  • Read the numbers from the file into an array or list

  • Apply the sorting algorithm to the array or list

  • Write the sorted numbers back to the file

Add your answer
Q258. Anagram Pairs

Check if two strings are anagram or not.

View 3 more answers
Q259. General Questions

1) Explain DNS
2) What is DHCP
3) What is SIP protocol
4) Difference between TCP/UDP
5) Difference between HTTP/HTTPs
6) What is proxy server.
7) Some basics Linux commands
8) What is BCNF in DBMS.

Add your answer
Q260. Diagonal Traversal of a binary tree.

You have been given a binary tree of integers. You are supposed to find the diagonal traversal(refer to Example) of the given binary tree.

Example:

Consider lines at an angle...read more
Add your answer
Q261. Max GCD Pair

You are given an array of positive integers. Find the GCD(Greatest Common Divisor) of a pair of elements such that it is maximum among all possible pairs. GCD(a, b) is the maximum number x such that...read more

View 2 more answers
Q262. Rat In A Maze

You are given a starting position for a rat which is stuck in a maze at an initial point (0, 0) (the maze can be thought of as a 2-dimensional plane). The maze would be given in the form of a squar...read more

Add your answer
Q263. Spiral Matrix

You are given a N x M matrix of integers, return the spiral path of the matrix

Example Of Spiral Path

Spiral Path

Input Format:
The first line contains an integer 'T' which denotes the number of test cases or...read more
View 2 more answers
Q264. Game of 3

The Ultimate Ninja Ankush was bored, so his friend Ninja Nikhil decided to give him a puzzle to keep him entertained. Nikhil gave Ankush ‘N’ integers and asked how many groups of sizes 2 and 3 can be f...read more

Add your answer
Asked in
SDE Interview

Q265. A stream of data is coming. Maintain records in a page and mechanism to see previous and next page. (Concept of Doubly Linked List) (It is always advisable to ask questions in design questions. The interviewers...

read more
Ans.

A thread is a unit of execution within a process that can run independently and concurrently with other threads.

  • Threads allow for concurrent execution of tasks within a program.

  • Threads share the same memory space and resources of the process they belong to.

  • Threads can communicate and synchronize with each other through shared data structures like locks and semaphores.

  • Threads can improve performance by utilizing multiple CPU cores or by handling I/O operations asynchronously.

  • E...read more

Add your answer

Q266. Given a sorted array of integers, find the frequency of 2 in the array in log(n) time.

Ans.

Find frequency of 2 in sorted array of integers in log(n) time.

  • Use binary search to find first and last occurrence of 2 in array.

  • Calculate frequency by subtracting last index from first index and adding 1.

  • Time complexity is O(log(n)).

View 39 more answers
Q267. DBMS Questions

Define ACID and explain with examples. There were few questions on join queries. These were of medium complexity.

Add your answer
Q268. Technical Questions

Compiler design related questions, differences between Python and C in very depth.

Low level vs High level language, kernel related questions

Add your answer
Q269. Least common ancestor

You are given an arbitrary binary tree with N nodes, whose nodes have their values in the range of integers. You are given two nodes x, y from the tree. You have to print the least common a...read more

View 2 more answers
Q270. Row Wave Form

You are given a 2D array with dimensions ‘N*M’. You need to read the array elements row-wise and return a linear array that stores the elements like a wave i.e the 1st-row elements are stored from ...read more

View 2 more answers
Q271. Merge overlapping intervals

Given 'N' number of intervals, where each interval contains two integers denoting the boundaries of the interval. The task is to merge all the overlapping intervals and return the lis...read more

View 2 more answers
Q272. Ninja Port

Ninja is stuck in a city with ‘N’ colonies, and each colony contains ‘K’ houses. Ninja is currently at the house number “sourceHouse” present in the colony with colony number “sourceColony”. He wants ...read more

Add your answer

Q273. A stream of numbers are coming and I have to keep track of the kth largest number in it

Ans.

Keep track of kth largest number in a stream of numbers.

  • Use a min-heap of size k to keep track of kth largest number.

  • For each incoming number, compare it with the root of the heap.

  • If it is larger than the root, replace the root with the new number and heapify.

  • The root of the heap will always be the kth largest number.

Add your answer
Q274. Number of Pairs with Given Sum

You have been given an integer array/list(arr) and a number 'Sum'. Find and return the total number of pairs in the array/list which when added, results equal to the 'Sum'.

Note:
G...read more
View 3 more answers

Q275. How do you limit distraction

Ans.

To limit distractions, I prioritize tasks, create a dedicated workspace, and use time management techniques.

  • Prioritize tasks by creating a to-do list and focusing on important tasks first

  • Create a dedicated workspace free from distractions like noise and clutter

  • Use time management techniques such as the Pomodoro Technique or time blocking

  • Minimize interruptions by turning off notifications or using focus apps

  • Practice self-discipline and set boundaries to avoid getting distracte...read more

View 59 more answers
Q276. Running median

Running median of input stream.

View 4 more answers
Q277. Technical Questions

He asked me what does an auto variable mean, how map sorts its keys, difference between map and unordered map’s working, and write down output for each iteration, then later he asked time com...read more

Add your answer
Q278. Print boundary Values of the Binary Tree

You have been given a binary tree of integers. Your task is to print the boundary nodes of this binary tree in Anti-Clockwise direction starting from the root node.

NOTE:...read more
View 2 more answers
Q279. Course Schedule II

You have been given ‘N’ courses and some courses may have prerequisites. Now consider a matrix ‘PREREQUISITES’ of size 'M' x 2 which represents that you must complete course 'PREREQUISITES[i][...read more

View 2 more answers
Q280. Validate BST

You have been given a binary tree of integers with N number of nodes. Your task is to check if that input tree is a BST (Binary Search Tree) or not.

A binary search tree (BST) is a binary tree data ...read more

View 2 more answers
Q281. Clone a binary tree with random pointers.

You are given a binary tree. Apart from the left and right child pointers, each node in the given binary tree points to a random node in the given binary tree. You are s...read more

View 2 more answers
Q282. Furthest Building You Can Reach

Ninja is in the mood for a walk over the city, but being a ninja he prefers jumping over building roofs instead of walking through the streets.

The height of the buildings in his ...read more

View 2 more answers
Q283. Bracket Number

Given a string ‘S’ comprising of some brackets. You need to print the number of every bracket.

For Example:
If S = (pq)() Then the output will be 1 1 2 2. First pair of opening and closing bracket...read more
Add your answer
Q284. Detect Cycle in a Directed Graph

Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least one cycle, else return false.

Inpu...read more
Add your answer
Q285. Equation Solver

You are given an equation of the addition of two numbers. One number among the two operands is missing in the given equation and is denoted by ‘x’. You have to find this missing number and return...read more

Add your answer
Q286. Zigzag Binary Tree Traversal

Given a binary tree, return the zigzag level order traversal of the nodes' values of the given tree. Zigzag traversal means starting from left to right, then right to left for the ne...read more

Add your answer
Q287. Implement Stack with Linked List

You need to implement the Stack data structure using a Singly Linked List.

Create a class named 'Stack' which supports the following operations(all in O(1) time):


getSize: Retur...read more
Add your answer
Q288. Relative Sorting

Given two arrays ‘ARR’ and ‘BRR’ of size ‘N’ and ‘M’ respectively. Your task is to sort the elements of ‘ARR’ in such a way that the relative order among the elements will be the same as those a...read more

View 3 more answers

Q289. there is an infinite stair case and there are n rounds. in i'th round we can jump i steps at one or discard them. it is given that k'th step is broken , find the max height we can reach with out stepping on the...

read more
Ans.

Given an infinite staircase with a broken kth step, find the maximum height we can reach in n rounds of jumping i steps.

  • We can start by jumping the maximum number of steps in each round until we reach the broken step.

  • After reaching the broken step, we can discard the i steps that would land us on the broken step and jump the remaining steps.

  • We can continue this pattern until we reach the maximum height we can reach without stepping on the broken step.

Add your answer
Q290. Check Subset

You are given two integer arrays ARR1 and ARR2 of length N and M respectively. You have to return true if ARR2 is a subset of ARR1, otherwise, return false.

For Example:

If the given arrays are [1, ...read more
View 2 more answers
Q291. Design the logic for minimising cash flow in an app like ‘Splitwise’.
Add your answer
Q292. Write a SQL query to find 3rd largest salary in a database
Add your answer
Q293. Delete N nodes after M nodes of a linked list

You have given a singly linked list and two integers 'N' and 'M'. Delete 'N' nodes after every 'M' node, or we can say more clearly that traverse the linked list suc...read more

Add your answer
Q294. Print Like A Wave

For a given two-dimensional integer array/list ‘ARR’ of size (N x M), print the ‘ARR’ in a sine wave order, i.e., print the first column top to bottom, next column bottom to top, and so on.

For...read more

Add your answer

Q295. Given a Binary Tree, if it is a BST or not

Ans.

Check if a Binary Tree is a Binary Search Tree (BST)

  • A BST has the property that all nodes in the left subtree of a node have values less than the node's value, and all nodes in the right subtree have values greater than the node's value

  • We can traverse the tree in-order and check if the resulting sequence is sorted

  • Alternatively, we can recursively check if each node satisfies the BST property

Add your answer
Q296. Merge k sorted lists

Given 'K' sorted linked lists, each list is sorted in increasing order. You need to merge all these lists into one single sorted list. You need to return the head of the final linked list.

I...read more
View 3 more answers
Q297. Sort an array in wave form

You have been given an unsorted array ‘ARR’.

Your task is to sort the array in such a way that the array looks like a wave array.

Example:
If the given sequence ‘ARR’ has ‘N’ elements ...read more
View 3 more answers
Q298. System Design Questions

Design YouTube/Netflix (a global video streaming service)

Design Search Typeahead

Add your answer
Q299. Remove All The Palindromes

Sushant is learning about palindromes. One day his teacher gave him a string ‘STR’ consisting of only the lowercase letters and asked him to modify the string in such a way that the st...read more

Add your answer
Q300. Maximum sum rectangle

You are given an M X N matrix of integers ARR. Your task is to find the maximum sum rectangle.

Maximum sum rectangle is a rectangle with the maximum value for the sum of integers present wi...read more

View 2 more answers
1
2
3
4
5
6
7

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 Kangeya Labs

based on 1.6k interviews in the last 1 year
Interview experience
4.3
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

4.1
 • 529 Interview Questions
3.6
 • 377 Interview Questions
3.4
 • 311 Interview Questions
4.0
 • 133 Interview Questions
4.1
 • 129 Interview Questions
View all
Top Amazon Interview Questions And Answers
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