/**
 * This function takes a dictionary of number line representation and a number,
 * and returns the location of the number on the number line.
 *
 * @param numberDictionary A dictionary where the keys represent numbers and the values represent their location on the number line.
 * @param number The number to find the location of.
 * @return The location of the number on the number line.
 *
 * Example:
 * val numberDictionary = mapOf(0 to "A", 1 to "B", 2 to "C", 3 to "D", 4 to "E")
 * val number = 3
 * getNumberLocation(numberDictionary, number) -> "D"
 */
fun getNumberLocation(numberDictionary: Map<Int, String>, number: Int): String {

    // Sort the dictionary based on the keys (numbers) in ascending order
    val sortedDictionary = numberDictionary.toList().sortedBy { it.first }

    // Iterate through the sorted dictionary
    for (i in sortedDictionary.indices) {
        // Check if the current number is greater than the given number
        if (sortedDictionary[i].first > number) {
            // Return the location of the previous number in the dictionary
            return sortedDictionary[i - 1].second
        }
    }

    // If the given number is greater than all numbers in the dictionary, return the last location
    return sortedDictionary.last().second
}
/**
 * This function takes a dictionary of number line representation and a number,
 * and returns the location of the number on the number line.
 *
 * @param numberDictionary A dictionary where the keys represent numbers and the values represent their location on the number line.
 * @param number The number to find the location of.
 * @return The location of the number on the number line.
 *
 * Example:
 * val numberDictionary = mapOf(0 to "A", 1 to "B", 2 to "C", 3 to "D", 4 to "E")
 * val number = 3
 * getNumberLocation(numberDictionary, number) -> "D"
 */
fun getNumberLocation(numberDictionary: Map<Int, String>, number: Int): String {
/**
 * This function takes a dictionary of number line representation and a number,
 * and returns the location of the number on the number line.
 *
 * @param numberDictionary A dictionary where the keys represent numbers and the values represent their location on the number line.
 * @param number The number to find the location of.
 * @return The location of the number on the number line.
 *
 * Example:
 * val numberDictionary = mapOf(0 to "A", 1 to "B", 2 to "C", 3 to "D", 4 to "E")
 * val number = 3
 * getNumberLocation(numberDictionary, number) -> "D"
 */
fun getNumberLocation(numberDictionary: Map<Int, String>, number: Int): String {

    // Sort the dictionary based on the keys (numbers) in ascending order
    val sortedDictionary = numberDictionary.toList().sortedBy { it.first }

    // Iterate through the sorted dictionary
    for (i in sortedDictionary.indices) {
        // Check if the current number is greater than the given number
        if (sortedDictionary[i].first > number) {
            // Return the location of the previous number in the dictionary
            return sortedDictionary[i - 1].second
        }
    }

    // If the given number is greater than all numbers in the dictionary, return the last location
    return sortedDictionary.last().second
}