Skip to content
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

Week5 #13

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Week5 #13

wants to merge 4 commits into from

Conversation

arinming
Copy link
Collaborator

@arinming arinming commented Oct 5, 2024

@arinming arinming requested a review from chattymin October 5, 2024 09:17
@arinming arinming self-assigned this Oct 5, 2024
Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번주도 고생하셨어요~~~

Comment on lines +4 to +10
fun solution(a: Int, b: Int): String {
val daysOfMonth = listOf(0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
val dayOfWeek = listOf("FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU")
val totalDays = (1 until a).sumOf { daysOfMonth[it] } + b - 1

return dayOfWeek[totalDays % 7]
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오... 상당히 깔끔하네요 코드가

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사실 제 코드 처음에 너무 복잡하길래 블로그에서 이거저것........눈팅했읍니다

Comment on lines +17 to +23
fun checkPrime(num: Long): Boolean {
if (num < 2) return false
for (i in 2..Math.sqrt(num.toDouble()).toLong()) {
if (num % i == 0L) return false
}
return true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 이번에 구현하면서 깨달은건데 짝수는 2로 나눠지니 2로 나눠보고, 그 후부터는 3으로 시작해서 2씩 늘리면 시간이 완전 단축되더라구요!

물론 에라토스테네스의 체 같은 알고리즘을 쓰면 좋지만 그걸 전 외우진 못해서... ㅎㅎ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오오오오옹..........!!!!!!!!!!!!!! 그런 부분까지,,. 진짜 코테는 너머 어려워요 ㅠㅠ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants