FastPrepTrace Pointer Rebinding and Pointee Updates
Problems/Trace Pointer Rebinding and Pointee Updates

Trace Pointer Rebinding and Pointee Updates

Arista Networks logoArista Networks● EasyFULLTIMENEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Arista Networks phone screen for full-time and new grad roles. The report is a debugging task. It asks why assigning to a local copy of a pointer does not change the caller, and how writing through the pointer changes the value you see. We chose the smallest setup: a sequence of clear rebind and write operations. Our version is about 92% the same as the reported question.

A function receives a pointer to a caller-owned integer by value. Process each operation in order:

  • WRITE:x writes x through the function's current pointer.
  • REBIND:x changes only the function's local pointer copy so it points to a local integer whose value is x.

Once rebound, later writes affect the local integer rather than the caller-owned integer. Return the caller-owned value after the function returns.

Function

callerValueAfter(initialValue: int, operations: String[]) → int

Examples

Example 1

initialValue = 10operations = ["REBIND:100"]return = 10

Rebinding changes only the local pointer copy, so the caller still observes 10.

Example 2

initialValue = 10operations = ["WRITE:100"]return = 100

Writing through the original pointer updates the caller-owned integer.

Constraints

  • -1000000000 <= initialValue <= 1000000000.
  • 0 <= operations.length <= 100000.
  • Every operation is WRITE:x or REBIND:x, where x is a signed 32-bit integer.

More Arista Networks interview questions

  • First Missing Number in a Consecutive ArrayOA · PHONE SCREEN · Seen Oct 2026
  • Remove All Repeated Values from a Linked ListPHONE SCREEN · Seen Oct 2026
  • Trace Nested Object Destruction OrderPHONE SCREEN · Seen Oct 2026
  • Swap Adjacent NibblesPHONE SCREEN · Seen Aug 2026
  • Unique Target-Sum Pairs in a Sorted Doubly Linked ListPHONE SCREEN · Seen Aug 2026
  • Generic Stack Operation SequencePHONE SCREEN · Seen Aug 2026
  • API Bandwidth AllocationOA · Seen Sep 2026
  • LFU CacheOA · Seen Sep 2026
  • Maximum Server Processing TimeOA · Seen Aug 2026
  • Minimum Adjacent Merges to Form a PalindromeOA · Seen Aug 2026

Similar questions at other companies

  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Format a Signed Integer with CommasHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Run-Length DecodingApple · PHONE SCREENApple interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Decode and Store StringsAirbnb · PHONE SCREENAirbnb interview questions
  • Delimiter-Parsing String Iteratoramo · PHONE SCREEN
  • SimpleRDD Word CountDatologyAI · PHONE SCREEN
All Arista Networks interview questionsSee Arista Networks hiring insights
Saved
class Solution {
    public int callerValueAfter(int initialValue, String[] operations) {
        // Write your code here.
    }
}
Checking account…