Skip to content

Commit 85d8251

Browse files
committed
solve 카펫 with kt
1 parent 8e093a7 commit 85d8251

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

카펫/solution.kt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
fun solution(brown: Int, yellow: Int): IntArray {
3+
val sum = brown + yellow
4+
val answer = intArrayOf(0,0)
5+
for(i in sum/2 downTo 2){
6+
if(sum % i == 0 && ((i-2) * (sum / i - 2)) == yellow) {
7+
answer[0] = i
8+
answer[1] = sum / i
9+
break
10+
}
11+
}
12+
return answer
13+
}
14+
}

0 commit comments

Comments
 (0)