FastPrepApply Binary State Operations
Problems/Apply Binary State Operations

Apply Binary State Operations

Visa logoVisa● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A November 8, 2025 Visa CodeSignal OA report gives the all-zero starting state, a load operation that fills the leftmost zero, a clear operation by index including multi-digit indices, and string output. It leaves out limits, what a load does when the array is full, and a function signature. Here, a load on a full array does nothing.

You have a binary state array of length n, initially filled with 0. Apply the strings in operations in order:

  • "L": find the leftmost state equal to 0 and change it to 1. If no zero remains, do nothing.
  • "Cj": change the state at zero-based index j to 0, regardless of its current value. The index may contain multiple digits.

Return the final state as a string of 0 and 1 characters.

Function

applyBinaryStateOperations(n: int, operations: String[]) → String

Examples

Example 1

n = 8operations = ["L","L","C1","C6","L"]return = "11000000"

The first two operations set indices 0 and 1. C1 clears index 1, C6 leaves an existing zero unchanged, and the final L sets index 1 again.

Example 2

n = 4operations = ["L","L","L","C0","L"]return = "1110"

Three loads produce 1110. Clearing index 0 produces 0110, and the last load selects index 0 again.

Constraints

  • 1 <= n <= 105
  • 1 <= operations.length <= 105
  • Every operation is either "L" or "Cj" for an index 0 <= j < n.

More Visa Online Assessment questions

  • Count Prime Values in SubtreesOA · Seen Nov 2026
  • Lock CodeOA · Seen Nov 2026
  • Minimum-Sum Tree Fill with Unit StepsOA · Seen Nov 2026
  • Longest Non-Decreasing Substring After Pair SwapsOA · Seen Oct 2026
  • Count Attack Vectors by Divisor RangeOA · Seen Oct 2026
  • Minimum Operations to Reduce a Transaction LedgerOA · Seen Oct 2026
  • Count Valid Space-Delimited WordsOA · Seen Oct 2026
  • Earliest Common Meeting StartOA · Seen Oct 2026
  • Maximum Index-Weighted Sum with Disjoint SwapsOA · Seen Oct 2026
  • Maximum Equalized Substrings After One Adjacent SwapOA · Seen Sep 2026

Similar questions at other companies

  • Theme Park Shuttle Wait TimeAirbnb · OAAirbnb interview questions
  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Book Reading EveningsGoogle · OAGoogle interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
  • Lift Total TravelInfosys · OAInfosys interview questions
  • Shell Command Counts with History ReferencesTikTok · OATikTok interview questions
  • Count Dropped RequestsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Recursively Expanded Shell Command CountsHudson River Trading · OAHudson River Trading interview questions
All Visa interview questionsSee Visa hiring insights
Saved
class Solution {
    public String applyBinaryStateOperations(int n, String[] operations) {
        // Write your code here.
    }

}
Checking account…