/**
 * Given a list of dancers' positions and a target position, find the dancer at the target
 * position using conditional statements and integer operations.
 *
 * @param dancerList A list of integers representing the positions of the dancers.
 * @param targetPosition The target position to find the dancer.
 * @return The name of the dancer at the target position, or "Position not found" if no dancer is found.
 */
fun getDancerPosition(dancerList: List<Int>, targetPosition: Int): String {

    // Initialize variables for dancer names and positions
    val dancerNames = listOf("Alice", "Bob", "Charlie", "David", "Eve")
    val dancerPositions = listOf(0, 2, 5, 8, 10)

    // Check if the target position is within the range of dancer positions
    if (targetPosition < dancerPositions.minOrNull() ?: Int.MIN_VALUE || targetPosition > dancerPositions.maxOrNull() ?: Int.MAX_VALUE) {
        return "Position not found"
    }

    // Iterate through the dancer positions
    for (i in 0 until dancerPositions.size - 1) {
        // Check if the target position falls between two adjacent dancer positions
        if (targetPosition >= dancerPositions[i] && targetPosition < dancerPositions[i + 1]) {
            return dancerNames[i]
        }
    }

    return "Position not found"
}
/**
 * Given a list of dancers' positions and a target position, find the dancer at the target
 * position using conditional statements and integer operations.
 *
 * @param dancerList A list of integers representing the positions of the dancers.
 * @param targetPosition The target position to find the dancer.
 * @return The name of the dancer at the target position, or "Position not found" if no dancer is found.
 */
fun getDancerPosition(dancerList: List<Int>, targetPosition: Int): String {
/**
 * Given a list of dancers' positions and a target position, find the dancer at the target
 * position using conditional statements and integer operations.
 *
 * @param dancerList A list of integers representing the positions of the dancers.
 * @param targetPosition The target position to find the dancer.
 * @return The name of the dancer at the target position, or "Position not found" if no dancer is found.
 */
fun getDancerPosition(dancerList: List<Int>, targetPosition: Int): String {

    // Initialize variables for dancer names and positions
    val dancerNames = listOf("Alice", "Bob", "Charlie", "David", "Eve")
    val dancerPositions = listOf(0, 2, 5, 8, 10)

    // Check if the target position is within the range of dancer positions
    if (targetPosition < dancerPositions.minOrNull() ?: Int.MIN_VALUE || targetPosition > dancerPositions.maxOrNull() ?: Int.MAX_VALUE) {
        return "Position not found"
    }

    // Iterate through the dancer positions
    for (i in 0 until dancerPositions.size - 1) {
        // Check if the target position falls between two adjacent dancer positions
        if (targetPosition >= dancerPositions[i] && targetPosition < dancerPositions[i + 1]) {
            return dancerNames[i]
        }
    }

    return "Position not found"
}