728x90
😉 아이디어
1. 시간초과를 방지하기 위해, _!left ~ right!_사이의 _!i!_값에 대응하는 배열 인덱스 산출
2. 해당 인덱스에 일치하는 배열의 값 저장
😉 풀이
def calcVal(x, y):
# 주어진 인덱스 중 최대값 + 1 = 배열의 값
return max(x, y) + 1
def solution(n, left, right):
answer = []
for i in range(left, right + 1):
# i 값 대응 배열 인덱스 산출
y = i // n; x = (i % n)
answer.append(calcVal(x, y))
return answer
✔️ 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/87390#