/**
 * This exercise aims to test your understanding of modifying lists with loops and looping structures.
 *
 * Given a list of artists, your task is to modify the list by repeating each artist a certain number of times.
 * The number of repetitions for each artist should be equal to the index position of that artist in the original list.
 *
 * For example, if the original list is ['Bob', 'Alice', 'John'], the modified list should be
 * ['Bob', 'Alice', 'Alice', 'John', 'John', 'John'].
 *
 * Your goal is to complete the code to achieve the desired modified list effect.
 */
fun modifyArtistList(artistList: List<String>, numTimes: Int): List<String> {

    val modifiedList = mutableListOf<String>()
    for ((index, artist) in artistList.withIndex()) {
        // Multiply the artist by its index (number of repetitions)
        modifiedList.addAll(List(index) { artist })
    }
    return modifiedList
}
/**
 * This exercise aims to test your understanding of modifying lists with loops and looping structures.
 *
 * Given a list of artists, your task is to modify the list by repeating each artist a certain number of times.
 * The number of repetitions for each artist should be equal to the index position of that artist in the original list.
 *
 * For example, if the original list is ['Bob', 'Alice', 'John'], the modified list should be
 * ['Bob', 'Alice', 'Alice', 'John', 'John', 'John'].
 *
 * Your goal is to complete the code to achieve the desired modified list effect.
 */
fun modifyArtistList(artistList: List<String>, numTimes: Int): List<String> {
/**
 * This exercise aims to test your understanding of modifying lists with loops and looping structures.
 *
 * Given a list of artists, your task is to modify the list by repeating each artist a certain number of times.
 * The number of repetitions for each artist should be equal to the index position of that artist in the original list.
 *
 * For example, if the original list is ['Bob', 'Alice', 'John'], the modified list should be
 * ['Bob', 'Alice', 'Alice', 'John', 'John', 'John'].
 *
 * Your goal is to complete the code to achieve the desired modified list effect.
 */
fun modifyArtistList(artistList: List<String>, numTimes: Int): List<String> {

    val modifiedList = mutableListOf<String>()
    for ((index, artist) in artistList.withIndex()) {
        // Multiply the artist by its index (number of repetitions)
        modifiedList.addAll(List(index) { artist })
    }
    return modifiedList
}