/**
 * This function takes a list of tuples as input and sorts the tuples based on the second element of each tuple in descending order.
 *
 * @param tuples A list of tuples containing two elements.
 * @return A sorted list of tuples based on the second element of each tuple in descending order.
 *
 * Example:
 * Input:
 * [(2, 5), (1, 4), (6, 2), (3, 8)]
 *
 * Output:
 * [(3, 8), (2, 5), (1, 4), (6, 2)]
 */
fun sortTuples(tuples: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    return tuples.sortedByDescending { it.second }
}
/**
 * This function takes a list of tuples as input and sorts the tuples based on the second element of each tuple in descending order.
 *
 * @param tuples A list of tuples containing two elements.
 * @return A sorted list of tuples based on the second element of each tuple in descending order.
 *
 * Example:
 * Input:
 * [(2, 5), (1, 4), (6, 2), (3, 8)]
 *
 * Output:
 * [(3, 8), (2, 5), (1, 4), (6, 2)]
 */
fun sortTuples(tuples: List<Pair<Int, Int>>): List<Pair<Int, Int>> {
/**
 * This function takes a list of tuples as input and sorts the tuples based on the second element of each tuple in descending order.
 *
 * @param tuples A list of tuples containing two elements.
 * @return A sorted list of tuples based on the second element of each tuple in descending order.
 *
 * Example:
 * Input:
 * [(2, 5), (1, 4), (6, 2), (3, 8)]
 *
 * Output:
 * [(3, 8), (2, 5), (1, 4), (6, 2)]
 */
fun sortTuples(tuples: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    return tuples.sortedByDescending { it.second }
}