Building digit by digit / base accumulation [mp]
Micro pattern¶
Description¶
Build a positional number by multiplying the accumulated result by its base and appending the next digit.
Problems¶
Decimal accumulation¶
Consume or produce decimal digits with positional multiplication or division.
- 7. Reverse Integer (Top Easy)
- 8. String to Integer (atoi) (Top Easy)
- 166. Fraction to Recurring Decimal (Top Medium)
- 227. Basic Calculator II (Top Hard)
Other bases¶
Apply positional accumulation in a nondecimal base.
- 190. Reverse Bits (Top Easy)
- 171. Excel Sheet Column Number (Top Medium)
Arithmetic output digits¶
Produce digits individually while carrying overflow to the next position.
- 2. Add Two Numbers (Top Medium)
- 445. Add Two Numbers II (Google Prep)