Panda Guru LogoPanda
Guru

Juspay - OA Need help

Round 1

Questions: A sorcerer has discovered a magical sequence of runes, represented as a string made up of two types of runes: X and Y. The sorcerer wants to maximize their magical power by transforming the sequence into more potent forms. The sorcerer can perform two types of transformations:

  1. Pick a substring XY, transform it into YZ, and gain one unit of magical power.
  2. Pick a substring YX, transform it into ZY, and gain one unit of magical power.

Your task is to find out the maximum magical power the sorcerer can accumulate by performing these transformations.

Input:

Output:

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.