/**
 * Given a list of tuples, where each tuple contains the name of an artist and their corresponding index,
 * this function finds the artist with the specified index and returns their name. If the index is not found,
 * it returns null. The artist tuples are assumed to be ordered by their index.
 *
 * @param tuples A list of tuples where each tuple contains the name of an artist and their corresponding index.
 * @param target An integer representing the index of the target artist to find.
 * @return The name of the artist with the target index, or null if not found.
 */
fun findArtistsWithIndex(tuples: List<Pair<String, Int>>, target: Int): String? {

    for ((artist, index) in tuples) {
        if (index == target) {
            return artist
        } else if (index > target) {
            break
        }
    }
    return null
}
/**
 * Given a list of tuples, where each tuple contains the name of an artist and their corresponding index,
 * this function finds the artist with the specified index and returns their name. If the index is not found,
 * it returns null. The artist tuples are assumed to be ordered by their index.
 *
 * @param tuples A list of tuples where each tuple contains the name of an artist and their corresponding index.
 * @param target An integer representing the index of the target artist to find.
 * @return The name of the artist with the target index, or null if not found.
 */
fun findArtistsWithIndex(tuples: List<Pair<String, Int>>, target: Int): String? {
/**
 * Given a list of tuples, where each tuple contains the name of an artist and their corresponding index,
 * this function finds the artist with the specified index and returns their name. If the index is not found,
 * it returns null. The artist tuples are assumed to be ordered by their index.
 *
 * @param tuples A list of tuples where each tuple contains the name of an artist and their corresponding index.
 * @param target An integer representing the index of the target artist to find.
 * @return The name of the artist with the target index, or null if not found.
 */
fun findArtistsWithIndex(tuples: List<Pair<String, Int>>, target: Int): String? {

    for ((artist, index) in tuples) {
        if (index == target) {
            return artist
        } else if (index > target) {
            break
        }
    }
    return null
}