/**
 * A dancer performs a sequence of moves for a given song length.
 * Complete the code to determine if the dancer's moves follow a specific pattern.
 *
 * @param songLength The length of the song in seconds (integer)
 * @param moveSequence A list of strings representing the dancer's moves
 * @return True if the dancer's moves form a pattern, False otherwise (boolean)
 */
fun dancerMoves(songLength: Int, moveSequence: List<String>): Boolean {

    // Check if the moves are an empty sequence
    if (moveSequence.isEmpty()) {
        return true
    }

    // Initialize the starting time and move index
    var time = 0
    var moveIndex = 0

    // Iterate until the end of the song
    while (time < songLength) {
        // Get the current move based on the move index
        val currentMove = moveSequence[moveIndex]

        // Determine the length of the current move
        val moveLength = when (currentMove) {
            "jump" -> 2
            "spin" -> 3
            else -> 1
        }

        // Check if the current move can be performed within the remaining song length
        if (time + moveLength <= songLength) {
            time += moveLength
            moveIndex = (moveIndex + 1) % moveSequence.size
        } else {
            return false
        }
    }

    return true
}
/**
 * A dancer performs a sequence of moves for a given song length.
 * Complete the code to determine if the dancer's moves follow a specific pattern.
 *
 * @param songLength The length of the song in seconds (integer)
 * @param moveSequence A list of strings representing the dancer's moves
 * @return True if the dancer's moves form a pattern, False otherwise (boolean)
 */
fun dancerMoves(songLength: Int, moveSequence: List<String>): Boolean {
/**
 * A dancer performs a sequence of moves for a given song length.
 * Complete the code to determine if the dancer's moves follow a specific pattern.
 *
 * @param songLength The length of the song in seconds (integer)
 * @param moveSequence A list of strings representing the dancer's moves
 * @return True if the dancer's moves form a pattern, False otherwise (boolean)
 */
fun dancerMoves(songLength: Int, moveSequence: List<String>): Boolean {

    // Check if the moves are an empty sequence
    if (moveSequence.isEmpty()) {
        return true
    }

    // Initialize the starting time and move index
    var time = 0
    var moveIndex = 0

    // Iterate until the end of the song
    while (time < songLength) {
        // Get the current move based on the move index
        val currentMove = moveSequence[moveIndex]

        // Determine the length of the current move
        val moveLength = when (currentMove) {
            "jump" -> 2
            "spin" -> 3
            else -> 1
        }

        // Check if the current move can be performed within the remaining song length
        if (time + moveLength <= songLength) {
            time += moveLength
            moveIndex = (moveIndex + 1) % moveSequence.size
        } else {
            return false
        }
    }

    return true
}