/**
 * This exercise requires implementing a function called indexAbsoluteValue that finds the index of the elements within an array that have an absolute value greater than a given threshold.
 *
 * @param numbers A list of numbers (both positive and negative).
 * @param threshold The threshold value for absolute comparison.
 * @return A list of indices where the element's absolute value is greater than the threshold.
 *
 * Example:
 * indexAbsoluteValue(listOf(-5, 10, -3, 2, -8), 3) -> [0, 1, 4]
 * indexAbsoluteValue(listOf(1, 2, 3, 4, 5), 2) -> []
 * indexAbsoluteValue(listOf(0, -1, 2, -3, 4), 2) -> [0, 1, 3]
 */
fun indexAbsoluteValue(numbers: List<Int>, threshold: Int): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate over the list of numbers
    for ((index, num) in numbers.withIndex()) {
        // Check if the absolute value of the number is greater than the threshold
        if (Math.abs(num) > threshold) {
            // If it is, add the index to the result list
            result.add(index)
        }
    }

    return result
}
/**
 * This exercise requires implementing a function called indexAbsoluteValue that finds the index of the elements within an array that have an absolute value greater than a given threshold.
 *
 * @param numbers A list of numbers (both positive and negative).
 * @param threshold The threshold value for absolute comparison.
 * @return A list of indices where the element's absolute value is greater than the threshold.
 *
 * Example:
 * indexAbsoluteValue(listOf(-5, 10, -3, 2, -8), 3) -> [0, 1, 4]
 * indexAbsoluteValue(listOf(1, 2, 3, 4, 5), 2) -> []
 * indexAbsoluteValue(listOf(0, -1, 2, -3, 4), 2) -> [0, 1, 3]
 */
fun indexAbsoluteValue(numbers: List<Int>, threshold: Int): List<Int> {
/**
 * This exercise requires implementing a function called indexAbsoluteValue that finds the index of the elements within an array that have an absolute value greater than a given threshold.
 *
 * @param numbers A list of numbers (both positive and negative).
 * @param threshold The threshold value for absolute comparison.
 * @return A list of indices where the element's absolute value is greater than the threshold.
 *
 * Example:
 * indexAbsoluteValue(listOf(-5, 10, -3, 2, -8), 3) -> [0, 1, 4]
 * indexAbsoluteValue(listOf(1, 2, 3, 4, 5), 2) -> []
 * indexAbsoluteValue(listOf(0, -1, 2, -3, 4), 2) -> [0, 1, 3]
 */
fun indexAbsoluteValue(numbers: List<Int>, threshold: Int): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate over the list of numbers
    for ((index, num) in numbers.withIndex()) {
        // Check if the absolute value of the number is greater than the threshold
        if (Math.abs(num) > threshold) {
            // If it is, add the index to the result list
            result.add(index)
        }
    }

    return result
}