-
저주의 숫자 3코딩 테스트/Level 0 2022. 11. 8. 17:27반응형
https://school.programmers.co.kr/learn/courses/30/lessons/120871
파이썬
def solution(n): answer = 0 for _ in range(n): answer += 1 while answer % 3 == 0 or '3' in str(answer): answer += 1 return answer
코틀린
class Solution { fun solution(n: Int): Int { var answer = 0 (0 until n).forEach { _ -> answer++ while (answer % 3 == 0 || '3' in answer.toString()) answer++ } return answer } }
반응형