770. Convert Decimal to Octal Number

Given a non-negative decimal number N, convert it to its octal representation as a string.

Example 1:

Input:聽17

Output:聽21

Explanation: 17 in decimal is 21 in octal.

Example 2:

Input:聽45

Output: 55

Explanation: 45 in decimal is 55 in octal.

Now Your Turn!

Pick the correct output for the given input

Input: 511

Still unsure what the problem is asking ?

Let鈥檚 go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= N <= 109
0
class Solution {
public:
string decimalToOctal(int N) {
// Your code goes here
}
};
Test Case

Input:

N