Panda Guru LogoPanda
Guru

Amazon OA | Feb 2025

Round 1

Questions:

Question 1

Amazon recently launched a new game, Fruit Crush! In this game, you are allowed to choose two dissimilar fruits and crush them. Each type of fruit is represented as an integer in an array. Formally, you can choose any two unequal integers in the array and delete them.
Given an array fruits of size n, return the minimum possible number of fruits left after performing the given operation any number of times.

Example

Function Description

Complete the function getMinFruits in the editor below.

Constraints

Question 2

Amazon Games has recently launched a new game involving dominoes. The game consists of n dominoes, where the i-th domino has a size domino[i]. The order of the dominoes is defined as the length of the longest strictly increasing subsequence (LIS) of the sizes of the dominoes.
An associated array, remove, contains n integers from 0 to n-1. In the i-th move, the player can remove the domino numbered remove[i].
Given the arrays domino and remove, find the maximum number of moves that can be made such that the order of the remaining dominoes is at least equal to a given integer min_order.

Example

Function Description

Complete the function getMaxPoints in the editor below.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.