/**
 * Given a list of photos, replace a specific range of elements with a new photo.
 *
 * @param photoList List of photos.
 * @param startIndex Starting index of the range to be replaced.
 * @param endIndex Ending index of the range to be replaced.
 * @param newPhoto New photo to be inserted.
 * @return Modified list with the specified range replaced by the new photo.
 */
fun replacePhotos(photoList: List<String>, startIndex: Int, endIndex: Int, newPhoto: String): List<String> {

    // Use slicing to get the photos before and after the range to be replaced
    val beforeRange = photoList.subList(0, startIndex)
    val afterRange = photoList.subList(endIndex + 1, photoList.size)

    // Use list concatenation to combine the photos before the range, the new photo, and the photos after the range
    val newPhotoList = beforeRange + listOf(newPhoto) + afterRange

    return newPhotoList
}
/**
 * Given a list of photos, replace a specific range of elements with a new photo.
 *
 * @param photoList List of photos.
 * @param startIndex Starting index of the range to be replaced.
 * @param endIndex Ending index of the range to be replaced.
 * @param newPhoto New photo to be inserted.
 * @return Modified list with the specified range replaced by the new photo.
 */
fun replacePhotos(photoList: List<String>, startIndex: Int, endIndex: Int, newPhoto: String): List<String> {
/**
 * Given a list of photos, replace a specific range of elements with a new photo.
 *
 * @param photoList List of photos.
 * @param startIndex Starting index of the range to be replaced.
 * @param endIndex Ending index of the range to be replaced.
 * @param newPhoto New photo to be inserted.
 * @return Modified list with the specified range replaced by the new photo.
 */
fun replacePhotos(photoList: List<String>, startIndex: Int, endIndex: Int, newPhoto: String): List<String> {

    // Use slicing to get the photos before and after the range to be replaced
    val beforeRange = photoList.subList(0, startIndex)
    val afterRange = photoList.subList(endIndex + 1, photoList.size)

    // Use list concatenation to combine the photos before the range, the new photo, and the photos after the range
    val newPhotoList = beforeRange + listOf(newPhoto) + afterRange

    return newPhotoList
}