Leetcode Problem 660. Remove 9

660. Remove 9

Leetcode Solutions

Base- Conversion Approach

  1. Initialize an empty string result to build the base-9 representation.
  2. While n is greater than 0: a. Calculate n modulo 9 to get the last digit of the base-9 representation. b. Prepend the digit to result. c. Divide n by 9 and update n to the quotient.
  3. Convert result to an integer and return it.
UML Thumbnail

Iterative Sequence Generation Approach

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...