Education + Jobs Hiring Website - 2026
0 like 0 dislike
10 views

Question 1: Minimum Cost with Ban and Sponsor Strings

We are given:

  • An integer N representing the number of rows.

  • A cost matrix with N rows and 4 columns, corresponding to the characters a, b, c, and d.

  • Two comma-separated strings: ban and sponsor.

The task is to determine the minimum total cost while following the restrictions involving the banned and sponsored characters.

Example:

N = 2

5 1 1 1
5 1 1 1

ban = ba,cc,dd
sponsor = a

Output: 6

I'm not completely sure about the exact wording of the restrictions, so any help reconstructing this question would be appreciated.

Question 2: Planting Seeds in Pots

We are given two arrays:

  • seeds – representing the sizes of seeds.

  • pots – representing the capacities of pots.

A seed can be planted in a pot only if:

pot >= seed and pot < 2 * seed

Each pot can hold at most one seed, and each seed can be planted in at most one pot.

The task is to find the maximum number of seeds that can be planted.

Example:

seeds = [2, 3, 4]
pots  = [3, 5, 8]

Output: 2

Question 3: Minimum Cost to Monitor Circular Towers

There are N towers arranged in a circular order.

A guard placed at a tower can monitor:

  • Their own tower.

  • The two neighboring towers on either side.

Therefore, one guard can monitor up to 5 towers.

Each tower is given with a cost and an indicator (0 or 1). We need to find the minimum cost required to ensure that all towers are monitored.

Examples:

Example 1:

N = 5

1 0
1 0
1 0
1 0
1 0

Output: 2

Example 2:

N = 5

1 1
1 0
1 0
1 0
1 0

Output: 1

Example 3:

N = 5

3 1
4 0
4 0
4 0
4 0

Output: 3

I hope this helps anyone preparing for the Infosys OA.

All the best to everyone appearing for the upcoming tests!

ago in Online Assessments by Expert (147,970 points) | 10 views

Please log in or register to answer this question.