FastPrepAdjacent Equal-Pair Removal Game
Problems/Adjacent Equal-Pair Removal Game

Adjacent Equal-Pair Removal Game

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three ZipRecruiter OA reports describe alternating turns, removing adjacent equal pairs, losing when you cannot move, and stack-based cancellation parity. The strongest report says Alice goes first. We supplied limits and a string input for the function.

Alice and Bob play a game on a string values. Alice moves first. On each move, remove any adjacent equal pair; the remaining characters close together.

A player who cannot move loses. Return "Alice" or "Bob" assuming optimal play.

Function

pairRemovalWinner(values: String) → String

Examples

Example 1

values = "aa"return = "Alice"

Alice removes the only pair, leaving Bob without a move.

Example 2

values = "abba"return = "Bob"

Two cancellations occur, so Bob makes the final move.

Constraints

  • 0 <= values.length <= 100000
  • values contains lowercase English letters.

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Smallest Value for a Linear Expression ModuloIntel · OA
  • Calculate a Token-List ExpressionCollege Vine · ONSITE INTERVIEW
  • Basic Calculator IISnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Basic Calculator II With Empty InputGoogle · ONSITE INTERVIEWGoogle interview questions
  • Evaluate Arithmetic with Operator PrecedenceRoblox · PHONE SCREENRoblox interview questions
  • Simplify a Formula with Known and Unknown VariablesBetter.com · PHONE SCREEN
  • Evaluate Parenthesized Addition and SubtractionAtlassian · PHONE SCREENAtlassian interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Perfect Squares Matching a PatternNielsen · OA

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String pairRemovalWinner(String values) {
        // Write your code here.
    }

}
Checking account…