Question: Infosys Specialist Programmer(SP) OA | Dynamic Programming & Bit Manipulation | Infosys SP Placement Questions | Array Sequence Optimization
0
Entering edit mode

Question 1: Hazardous Chamber (Ion Particles)

Problem Statement:

You are exploring a hazardous chamber filled with ion particles arranged in a line. Each particle i has an intensity I[i].

Whenever you decide to activate particle i, it releases an ion trail of magnitude:

trail_i = I[i] % (i + 3)

This trail interferes with future particles. After choosing particle i, any later particle j > i becomes unstable (and therefore cannot be selected) if:

((I[j] xor I[i]) % 6) == trail_i

Your goal is to select as many stable particles as possible, in strictly increasing index order. You may choose or skip any particle, but once a particle becomes unstable, it cannot be chosen later.

Find the maximum number of particles you can select while respecting instability rules.

Input Format:

  • The first line contains an integer, N, denoting the number of particles.
  • Each line i of the N subsequent lines (where 0 \le i < N) contains an integer describing the intensity I[i].

 


Question 2: Medium : Spectral Lockstep

Problem Statement:

You are an explorer of the Aurora Vaults, facing a line of spectral nodes numbered from 1 to N. Each node i glows with a spectral value S[i].

Every time you include a node in your expedition log, it prints a single-colour key into the vault's ledger:

Key(i) = (S[i] + i) % 5

But the ledger is tricky: as soon as you record node i, all later nodes j (j > i) whose(S[j] % 5)equalsKey(i)become locked — you cannot record them later in your sequence. Nodes already recorded remain safe.

You may decide, at each position scanning left to right, whether to record that node or skip it. Your aim is to record a sequence of nodes (strictly increasing indices) of maximum possible length under the locking rule.

Find the maximum possible length under the locking rule.

Input Format:

  • The first line contains an integer, N, denoting the number of spectral nodes.
  • (The subsequent lines will contain the spectral values S[i] for each node).
ADD COMMENTlink 7 hours ago Sarthak • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts