YourAlly

IBM Staff coding interview questions

These are the 3 coding questions YourAlly has tagged for IBM at Staff. On the YourAlly ladder this is Staff (E6), the same level as Google L6, Meta E6 and Amazon L7.

A coding round at a large tech company usually runs 45 to 60 minutes with one or two problems. You write code that runs, test it on your own examples and state its time and space cost. At this level interviewers also expect clean code quickly and edge cases you raise before they do.

Practice a mock IBM Staff coding loopPractice IBM coding questions

Find the First Deadlock in a Lock TraceFree to read

A database grants exclusive locks. Given a trace of [op, txn, resource] events where op is acquire or release, simulate the lock manager: a blocked acquire waits in FIFO order, and a release hands the lock to the next waiter. Return the index of the first event that creates a deadlock cycle in the wait-for graph, or -1 if none occurs.

Input: events = [[acquire,T1,A],[acquire,T2,B],[acquire,T1,B],[acquire,T2,A]] Output: 3

What a strong answer covers

  • Correct FIFO handoff on release
  • Out-degree at most one, so a chain walk replaces general cycle detection
  • Only blocking acquires checked
  • Non-holder release and re-acquire treated as no-ops
  • Complexity stated as O(E * L)

2 more coding questions

  1. Count Wildcard Topic Subscription Matches Locked
  2. Simulate Batch Initiators With Dependencies Locked

Sign up free to practice all 3

Related pages

More IBM Staff rounds

IBM coding at other levels

Other companies at this level