All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g2501_2600.s2582_pass_the_pillow.Solution.kt Maven / Gradle / Ivy

There is a newer version: 1.28
Show newest version
package g2501_2600.s2582_pass_the_pillow

// #Easy #Math #Simulation #2023_07_11_Time_122_ms_(85.71%)_Space_32.3_MB_(100.00%)

@Suppress("NAME_SHADOWING")
class Solution {
    fun passThePillow(n: Int, time: Int): Int {
        var time = time
        time %= ((n - 1) * 2)
        return n - kotlin.math.abs(n - 1 - time)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy