Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
great explanation ;)
Table of Contents0:00 Problem Statement0:39 Solution8:17 Pseudo Code10:06 Code - Python10:30 Code - C++
class Solution: def findNth(self,n): ans = 0 p = 1 while n: ans += p*(n%9) n = n//9 p *= 10 return ans
class Solution { public: long long findNth(long long n) { long long ans = 0; long long p = 1; while (n) { ans = ans + p*(n%9); n = n/9; p = p*10; } return ans; }};
great explanation ;)
Table of Contents
0:00 Problem Statement
0:39 Solution
8:17 Pseudo Code
10:06 Code - Python
10:30 Code - C++
class Solution:
def findNth(self,n):
ans = 0
p = 1
while n:
ans += p*(n%9)
n = n//9
p *= 10
return ans
class Solution {
public:
long long findNth(long long n) {
long long ans = 0;
long long p = 1;
while (n) {
ans = ans + p*(n%9);
n = n/9;
p = p*10;
}
return ans;
}
};