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

[이지민] 로봇 청소기, 보물섬, 센서, 합분해 #100

Merged
merged 4 commits into from
Feb 19, 2023

Conversation

jeeminimini
Copy link
Member

@jeeminimini jeeminimini commented Feb 19, 2023

📌 from issue #96 📌

📋문제 목록📋

로봇 청소기: ✅
보물섬: ✅ 
센서: ✅ 
합분해: ⛔️

@jeeminimini jeeminimini self-assigned this Feb 19, 2023
fun dfs(x: Int, y: Int, d: Int) {
rooms[x][y] = -1
var direction = -1
for (i in 3 downTo 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

와 down To 너무 좋네요!!

Comment on lines +51 to +64
val subQueue = mutableListOf<Pair<Int, Int>>()
queue.forEach{ num ->
for (i in 0 until 4) {
if(map[num.first + dx[i]][num.second + dy[i]] == "L") {
subQueue.add(Pair(num.first + dx[i], num.second + dy[i]))
map[num.first + dx[i]][num.second + dy[i]] = "W"
}
}
}
queue.clear()
queue = subQueue.toMutableList()
subQueue.clear()

sum += 1
Copy link
Contributor

Choose a reason for hiding this comment

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

풀이가 직관적으로 이해가 딱 됐습니다!! 구현력 대박입니다 이렇게 하면 L을 W으로 바꿔주면서 탐색해도 되는군여

println(result)
}

fun dfs(x: Int, y: Int, d: Int) {
Copy link
Member

Choose a reason for hiding this comment

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

dfs로 구현하신 점 대단하십니다..!!

Copy link
Member

Choose a reason for hiding this comment

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

대박!

Comment on lines +52 to +60
queue.forEach{ num ->
for (i in 0 until 4) {
if(map[num.first + dx[i]][num.second + dy[i]] == "L") {
subQueue.add(Pair(num.first + dx[i], num.second + dy[i]))
map[num.first + dx[i]][num.second + dy[i]] = "W"
}
}
}
queue.clear()
Copy link
Member

Choose a reason for hiding this comment

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

pop으로 forEach와 clear를 묶을 수 있지 않을까요??(queue)

map[x][y] = "W"

while(queue.isNotEmpty()) {
val subQueue = mutableListOf<Pair<Int, Int>>()
Copy link
Member

Choose a reason for hiding this comment

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

오홍🧐🧐

println(result)
}

fun dfs(x: Int, y: Int, d: Int) {
Copy link
Member

Choose a reason for hiding this comment

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

대박!

@jeeminimini jeeminimini merged commit f82683b into main Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants