Simple&Natural

Codility lesson3 - FrogJmp 본문

코딩테스트 풀이/Codility

Codility lesson3 - FrogJmp

Essense 2022. 4. 20. 08:01
728x90

 

fun solution(X: Int, Y: Int, D: Int): Int {
    if (X==Y) return 0

    return if ((Y-X)%D==0) (Y-X)/D else ((Y-X)/D)+1
}

 

 

https://app.codility.com/demo/results/trainingR5ZNAU-87U/

728x90

'코딩테스트 풀이 > Codility' 카테고리의 다른 글

Codility lesson3 - TapeEquilibrium  (0) 2022.04.28
Codility lesson3 - PermMissingElem  (0) 2022.04.27
Codility lesson2 - odd  (0) 2022.04.20
Codility lesson2 - cyclic rotation  (0) 2022.04.18
Codilidy lesson1 - binary gap  (0) 2022.04.17