Panda Guru LogoPanda
Guru

Juspay OA 2025

Round 1

Questions:

Question

Mike is a logistics manager at a parcel delivery company. Each day, a fleet of delivery vans is assigned to deliver packages along various routes in the city. There are n delivery stops, each initially assigned a certain number of parcels represented by an array p. However, the company allows the vans to load additional parcels at each stop based on a permutation of the delivery stops from 1 to n.

Mike can choose exactly one permutation of stops, q1, q2, qn, and change the number of parcels at each stop according to the rule: p[i]:= p[i] + q[i]. After modifying the parcels with the permutation, Mike wants to maximize the number of stops that now have the same number of parcels.

Your task is to find the maximum possible number of stops that can have the same parcel count after this operation.

Here

Input

Output

Sample input

6 1 1 1 1 1 2

Sample output

2
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Round 2

Questions:

Question

The Kingdom's Rebellion

In the Kingdom of Arborvale, there is a hierarchical system of nobles, arranged in a tree-like structure. The kingdom has n nobles, each assigned a unique number from 1 to n. At the top of the hierarchy is the King, who is considered the root of the kingdom's structure.

Each noble has a parent, except for the King, who has no parent. The nobles have ancestral respect rules:

Given the tension in the kingdom, you decide to remove rebellious nobles one by one to restore peace. The process of removal is as follows:

  1. You select a non-root noble that is rebellious (does not respect its parent) and has no children that respect it. If there are multiple such nobles, select the one with the smallest number.
  2. When you remove a rebellious noble, all of its children are immediately re-assigned to its parent.
  3. The process continues until there are no more nobles that meet the removal criteria.

Your task is to determine the order in which you will remove the rebellious nobles, if possible.

Input

It is guaranteed that the values of p_i define a valid hierarchical tree with n nobles.

Output

Sample input:

6 -1 0 1 1 1 1 3 1 3 0 3 0

Sample output:

2 4
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Round 3

Questions:

Question

City Block Partition

In the city of Gridopolis, the city is arranged in a block formation with 2 parallel streets and n intersections (blocks) along each street. Some blocks are open and accessible (free) while others are closed for construction (blocked). A block is accessible if it has a free passage on at least one of the streets.

Residents of Gridopolis want to ensure that their neighborhoods remain connected. Two blocks are part of the same neighborhood if they are accessible and can be reached through adjacent blocks (either horizontally or vertically).

Your task is to identify the critical blocks in the city grid: the block that, if closed for construction, would divide the city into exactly 3 separate neighborhoods.

Input

Output

Additional Constraints

Sample input:

8 .......x .x.xx...
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.