Search Questions

Latest Questions | Page 8

#1

Recursive Land Division

A country consists of N regions, each containing a specific number of towns. The government has decided to split the country into two separate nations in a way that minimizes the absolute difference between the total number of towns in each new nation.

Each region is connected to another region through roads, forming a tree structure (i.e., an undirected connected gra

Asked in: SHARECHAT


Buyer: 0
Code Size: 26
#2

Task
Calculate the number of pairs of investment (i, j) such that the return is a perfect square.
Example 1
Assumptions
Input
N = 4
Output: 6

Approach
(1, 1), (1, 4), (2, 2), (3, 3), (4, 1), and (4, 4) are the possible pairs.
Square Investment
Bob and John both have N dollars each and want to invest some money in Jack.
They will invest amounts i, j (1 โ‰ค i, j โ‰ค N). Jack has promised th

Asked in: SHARECHAT


Buyer: 0
Code Size: 29
#3

Your team at Amazon is working on a system that divides applications to a mixed cluster of computing devices. Each application is identified by an integer ID, requires a fixed non-zero amount of memory to execute, and is defined to be either a foreground or background application. IDs are guaranteed to be unique within their own application type, but not across types.

Each device should be assi

Asked in: AMAZON


Buyer: 0
Code Size: 28
#4

Amazon's Alexa team is working on optimizing the customer experience for scenarios where customers ask generic questions.
One example of a generic question is "What are good vegetarian restaurants nearby?"

In this example, Alexa would then search for a list of vegetarian restaurants in the city and select the nearest X vegetarian
restaurants relative to the customer's location. Given an ar

Asked in: AMAZON


Buyer: 0
Code Size: 10
#5

A student is preparing for a scholarship test which is organized on the Amazon Academy platform and scheduled for next month.
There are n chapters to be studied where the ith chapter has pages[i] pages. In one day, the student decides to read up to p of the remaining pages, each from some k consecutive chapters. Thus, the number of pages remaining to be read is reduced by p from each of these cha

Asked in: AMAZON


Buyer: 1
Code Size: 16
#6

Database security and authentication have become vital due to the increasing number of cyberattacks every day.
Amazon has created a team for the analysis of various types of cyberattacks. In one such analysis, the team finds
a virus that attacks the user passwords. The virus designed has an attacking rule defined by attackOrder, which is
a permutation of length n. In the ith second of the at

Asked in: AMAZON


Buyer: 0
Code Size: 29
#7

Given two servers and the time taken to upgrade each server in seconds, denoted by t1 and t2 respectively, in one second, one server undergoes the upgrade process. The servers receive requests at certain time intervals and pause upgrades during those seconds. The servers receive requests at multiples of req1 and req2 respectively. Determine the minimum total time (in seconds) required to upgrade

Asked in: EXPEDIA


Buyer: 3
Code Size: 39
#8

Given a set of nodes and a list of connected pairs, determine the order (number of nodes) in each connected component in the graph. For each component, calculate the ceiling of the square root of its order, and return the sum of these values across all connected components.

Example
graph_nodes = 10
graph_from = [1, 1, 2, 3, 7]
graph_to = [2, 3, 4, 5, 8]

There are graph_edges = 5 ed

Asked in: UBER


Buyer: 0
Code Size: 28
#9

Amazon is working on optimizing its delivery zones to ensure efficient and timely delivery of packages.
Each delivery zone is represented as an interval indicating the range of house numbers it covers.
The delivery zones can overlap.

Given is a list of n delivery zones, where the i-th zone covers the interval (a[i], b[i]) (inclusive).
Additionally, given is a maximum allowed length, k,

Asked in: AMAZON


Buyer: 0
Code Size: 25
#10

The Amazon Alexa development team needs to analyze request logs across numSkills different Alexa skills to ensure optimal performance and user engagement.

The skills are indexed from 1 to numSkills, and the logs are provided as a 2D array requestLogs of size m, where requestLogs[i] = [skill_ID, timeStamp] denotes that a request was made to the skill with ID skill_ID at the time timeStamp.

Yo

Asked in: AMAZON


Buyer: 1
Code Size: 26