Skip to main content
All Questions

Add two binary strings of up to 100,000 digits each and return the sum as a binary string with no leading zeros, without relying on a built-in big-integer type.

Unlock detailed company stats for this questionUpgrade
Two strings a and b contain only the characters 0 and 1, and each is a non-negative integer written in base 2. Return their sum as a binary string with no leading zeros. Each string can be from 0 to 100,000 characters long, so the values do not fit in a machine integer; the test tells you not to rely on a built-in arbitrary-precision integer type and to implement the addition yourself. An empty input is allowed by the limits; the original does not say how to read it, and zero is the natural choice. Example: 1011 plus 110 is 10001.

Community answers

No answers contributed by the community yet.

Related courses

Course

Behavioral Interviews: A Practical Guide for Engineers

Get offers at the level you deserve. Prep for senior+ behavioral interviews at FAANG and Tier-1 companies. Made with staff and principal engineers from Meta, Netflix, Google, and more. Avoid downleveling, elevate past projects, and stop sounding like a robot.

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.