-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[장희직] - 가장 긴 증가하는 부분 수열 4, 치즈, 삼각 달팽이, 내리막 길 #267
Conversation
if (dp[i] == find) { | ||
answer.add(sequence[i]) | ||
find -= 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오... 이렇게도 찾을 수 있군요 👍
d = (d + 1) % 3 | ||
y += dy[d] | ||
x += dx[d] | ||
return sum(b, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flatten 배워갑니다...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
최고,,,라서 드릴 말씀이 없네요
for (i in n - 1 downTo 0) { | ||
for (j in i + 1 until n) { | ||
if (sequence[i] >= sequence[j]) continue | ||
dp[i] = max(dp[i], dp[j] + 1) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시작부터 뒤에서 탐색하는 방법도 있군요..!
|
||
|
||
fun findAnswer(): Int { | ||
for (i in n - 1 downTo 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오?? 바깥쪽 i가 역순이어도 dp가 되는군요..??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵넵 뒤에서부터 탐색해도 됩니다!
ㅋㅋㅋ 저도 다른 분들 풀이 보고 앞이어도 되는군요? 했슴다 ㅋㅋ
d = (d + 1) % 3 | ||
y += dy[d] | ||
x += dx[d] | ||
return sum(b, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헐..미쳣네요 이게 flatten이라니..
# for i in range(cnt): | ||
# if i != 0: input_idx += i + (nest + nest) | ||
# answer_list[input_idx] = input_number | ||
# input_number += 1 | ||
# # _ | ||
# for i in range(cnt - 1): | ||
# input_idx += 1 | ||
# answer_list[input_idx] = input_number | ||
# input_number += 1 | ||
# # \ | ||
# for i in range(cnt - 2): | ||
# input_idx -= cnt - i + (nest + nest) | ||
# answer_list[input_idx] = input_number | ||
# input_number += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 근데 이 풀이도 인덱스 계산이 복잡한 와중에 통일성이 있게 계산하셨네요 ㄷㄷ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
쉽지 않았,,,😀
병희님 풀이도 배열 중간에 숫자 넣는 게 어려웠을 것 같은데👍
while num <= (n + 1) * n // 2: | ||
b[y][x] = num | ||
ny = y + dy[d] | ||
nx = x + dx[d] | ||
num += 1 | ||
if 0 <= ny < n and 0 <= nx <= ny and b[ny][nx] == 0: | ||
y, x = ny, nx | ||
else: | ||
d = (d + 1) % 3 | ||
y += dy[d] | ||
x += dx[d] | ||
return sum(b, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로직이 굉장히 깔끔하네유 👍 👍
📌 from issue #266 📌
📋문제 목록📋