/**
 * Given a list, start index, and end index, return the sliced portion of the list
 */
fun sliceList(lst: List<Any>, startIndex: Int, endIndex: Int): List<Any> {

    var slicedList = lst.toMutableList()

    if (startIndex >= endIndex) {
        return listOf("Invalid indices: start index must be less than end index")
    }

    // Validate indices
    val adjustedStartIndex = if (startIndex < 0) 0 else startIndex
    val adjustedEndIndex = if (endIndex > lst.size) lst.size else endIndex

    // Slice the list
    slicedList = slicedList.subList(adjustedStartIndex, adjustedEndIndex)

    return slicedList
}
/**
 * Given a list, start index, and end index, return the sliced portion of the list
 */
fun sliceList(lst: List<Any>, startIndex: Int, endIndex: Int): List<Any> {
/**
 * Given a list, start index, and end index, return the sliced portion of the list
 */
fun sliceList(lst: List<Any>, startIndex: Int, endIndex: Int): List<Any> {

    var slicedList = lst.toMutableList()

    if (startIndex >= endIndex) {
        return listOf("Invalid indices: start index must be less than end index")
    }

    // Validate indices
    val adjustedStartIndex = if (startIndex < 0) 0 else startIndex
    val adjustedEndIndex = if (endIndex > lst.size) lst.size else endIndex

    // Slice the list
    slicedList = slicedList.subList(adjustedStartIndex, adjustedEndIndex)

    return slicedList
}