EvalFrame Technical Mock Interviews & Coding Practice

Add Binary

Easy · Binary / Bit Manipulation · Algorithm problem · all problems

Given two binary strings `a` and `b`, return their sum as a binary string. **Examples:** ```typescript addBinary("11", "1") // "100" addBinary("1010", "1011") // "10101" ```

Solve It in the BrowserPractice Explaining It Out Loud

Optimal Approach

  • Time complexity: O(max(m, n))
  • Space complexity: O(max(m, n))

Processes each bit from right to left up to the length of the longer string.

Follow-Up Questions Interviewers Ask About Add Binary

  • Why not simply convert strings with parseInt(a, 2)?
    JavaScript numbers exceed safe integer precision (Number.MAX_SAFE_INTEGER is 2^53 - 1) for strings longer than 53 characters, causing precision loss.

Practice the full problem with execution, tests, and AI code review in the interactive lab — then rehearse explaining your solution in a live voice mock interview.