Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jung0115/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
| 21μ°¨μ‹œ | 2024.10.23.수 | DFS | [μ—¬ν–‰κ²½λ‘œ(Lv.2)](https://school.programmers.co.kr/learn/courses/30/lessons/43164) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/181 |
| 22μ°¨μ‹œ | 2024.10.30.수 | 브루트포슀 | [점 찍기(Lv.2)](https://school.programmers.co.kr/learn/courses/30/lessons/140107) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/182 |
| 23μ°¨μ‹œ | 2024.11.02.ν†  | 그리디 μ•Œκ³ λ¦¬μ¦˜ | [ꡬλͺ…λ³΄νŠΈ(Lv.2)](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/184 |
| 24μ²˜μ‚¬ | 2024.11.09.ν†  | 그리디 μ•Œκ³ λ¦¬μ¦˜ | [섬 μ—°κ²°ν•˜κΈ°(Lv.3)](https://school.programmers.co.kr/learn/courses/30/lessons/42861) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/187 |
| 24μ°¨μ‹œ | 2024.11.09.ν†  | 그리디 μ•Œκ³ λ¦¬μ¦˜ | [섬 μ—°κ²°ν•˜κΈ°(Lv.3)](https://school.programmers.co.kr/learn/courses/30/lessons/42861) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/187 |
| 25μ°¨μ‹œ | 2024.11.27.수 | 그리디 μ•Œκ³ λ¦¬μ¦˜ | [ν˜Έν…” λŒ€μ‹€(Lv.2)](https://school.programmers.co.kr/learn/courses/30/lessons/155651) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/189 |
| 26μ°¨μ‹œ | 2024.12.02.μ›” | μˆ˜ν•™ | [μ‹œμ†Œ 짝꿍(Lv.2)](https://school.programmers.co.kr/learn/courses/30/lessons/152996) | https://github.com/AlgoLeadMe/AlgoLeadMe-4/pull/190 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 25μ°¨μ‹œ 2024.11.27.수 : ν”„λ‘œκ·Έλž˜λ¨ΈμŠ€ - ν˜Έν…” λŒ€μ‹€(Lv.2)
import java.util.Arrays

class Solution {
fun solution(book_time: Array<Array<String>>): Int {
val times = IntArray(1440)

for (time in book_time) {
var start = time[0].substring(0, 2).toInt() * 60 + time[0].substring(3, 5).toInt()
var end = time[1].substring(0, 2).toInt() * 60 + time[1].substring(3, 5).toInt()

for (j in start until (end + 10).coerceAtMost(1440)) {
times[j]++
}
}

return times.maxOrNull() ?: 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ν”„λ‘œκ·Έλž˜λ¨ΈμŠ€ - 섬 μ—°κ²°ν•˜κΈ°(Lv.3)
# 24μ°¨μ‹œ 2024.11.09.ν†  : ν”„λ‘œκ·Έλž˜λ¨ΈμŠ€ - 섬 μ—°κ²°ν•˜κΈ°(Lv.3)
def solution(n, costs):
answer = 0

Expand Down
35 changes: 35 additions & 0 deletions jung0115/μˆ˜ν•™/Programmers_152996.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 26μ°¨μ‹œ 2024.12.02.μ›” : ν”„λ‘œκ·Έλž˜λ¨ΈμŠ€ - μ‹œμ†Œ 짝꿍(Lv.2)
class Solution {
fun solution(weights: IntArray): Long {
var answer: Long = 0
val weightCount = mutableMapOf<Int, Long>()

for(weight in weights) {
weightCount[weight] = weightCount.getOrDefault(weight, 0L) + 1
}

for((weight, count) in weightCount) {
// 같은 무게인 μ‚¬λžŒμ΄ 2λͺ… 이상 -> 1:1둜 앉을 수 있음
if(count > 1) {
answer += count * (count - 1) / 2
}

// 2:3 λΉ„μœ¨
if (weight % 2 == 0 && weightCount.containsKey(weight * 3 / 2)) {
answer += count * weightCount[weight * 3 / 2]!!
}

// 2:4 = 1:2 λΉ„μœ¨
if (weightCount.containsKey(weight * 2)) {
answer += count * weightCount[weight * 2]!!
}

// 3:4 λΉ„μœ¨
if (weight % 3 == 0 && weightCount.containsKey(weight * 4 / 3)) {
answer += count * weightCount[weight * 4 / 3]!!
}
}

return answer
}
}