
Add Binary
You receive two binary strings, a and b, and must return their sum as another binary string. The inputs contain only '0' and '1', have lengths from 1 to…
View solutionPerform arithmetic or numeric transformation directly over a digit representation, maintaining position-wise state such as carry, borrow, partial products, or reconstructed digits.
Tagged articles
4 articles in this tag.

You receive two binary strings, a and b, and must return their sum as another binary string. The inputs contain only '0' and '1', have lengths from 1 to…
View solution
The lists already expose digits in the order addition needs. Scan both lists together, track one carry, and keep going until there is no digit or carry…
View solution
Treat the product as a fixed array of decimal positions. Every digit pair has a predictable destination; carry normalization keeps those positions valid.
View solution
Adding one looks trivial until the last digit is 9. Then the problem becomes a compact state-tracking exercise: start where arithmetic begins, propagate a…
View solution