We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 36b979b commit fc422feCopy full SHA for fc422fe
Algorithm/ProgrammersCodingTest/PythonCodingTest.py
@@ -3865,4 +3865,23 @@ def solution(files):
3865
a = sorted(files, key=lambda file: int(re.findall('\d+', file)[0]))
3866
b = sorted(a, key=lambda file: re.split('\d+', file.lower())[0])
3867
3868
- return b
+ return b
3869
+
3870
3871
3872
+# 억억단을 외우자(138475) - Lv.3
3873
+def solution(e, starts):
3874
+ cnt = [1] * (e+1)
3875
3876
+ for num in range(1, e+1):
3877
+ for increment in range(num*2, e+1, num):
3878
+ cnt[increment] += 1
3879
3880
+ dp = [0] * (e+1)
3881
+ dp[e] = e
3882
3883
+ for i in reversed(range(1, e)):
3884
+ if cnt[i] >= cnt[dp[i+1]]: dp[i] = i
3885
+ else: dp[i] = dp[i+1]
3886
3887
+ return [dp[s] for s in starts]
0 commit comments