/**
 * Given a list, start index, and end index, this function should return a new list that contains a slice of the original list.
 *
 * @param listToSlice The original list to be sliced.
 * @param startIndex The starting index of the slice (inclusive).
 * @param endIndex The ending index of the slice (exclusive).
 * @return A new list containing a slice of the original list.
 *
 * Example:
 * sliceAList(listOf(1, 2, 3, 4, 5), 1, 4)
 * Output: [2, 3, 4]
 * Explanation: The slice starts at index 1 (inclusive) and ends at index 4 (exclusive), so it includes elements [2, 3, 4].
 */
fun sliceAList(listToSlice: List<Int>, startIndex: Int, endIndex: Int): List<Int> {

    return listToSlice.subList(startIndex, endIndex)
}
/**
 * Given a list, start index, and end index, this function should return a new list that contains a slice of the original list.
 *
 * @param listToSlice The original list to be sliced.
 * @param startIndex The starting index of the slice (inclusive).
 * @param endIndex The ending index of the slice (exclusive).
 * @return A new list containing a slice of the original list.
 *
 * Example:
 * sliceAList(listOf(1, 2, 3, 4, 5), 1, 4)
 * Output: [2, 3, 4]
 * Explanation: The slice starts at index 1 (inclusive) and ends at index 4 (exclusive), so it includes elements [2, 3, 4].
 */
fun sliceAList(listToSlice: List<Int>, startIndex: Int, endIndex: Int): List<Int> {
/**
 * Given a list, start index, and end index, this function should return a new list that contains a slice of the original list.
 *
 * @param listToSlice The original list to be sliced.
 * @param startIndex The starting index of the slice (inclusive).
 * @param endIndex The ending index of the slice (exclusive).
 * @return A new list containing a slice of the original list.
 *
 * Example:
 * sliceAList(listOf(1, 2, 3, 4, 5), 1, 4)
 * Output: [2, 3, 4]
 * Explanation: The slice starts at index 1 (inclusive) and ends at index 4 (exclusive), so it includes elements [2, 3, 4].
 */
fun sliceAList(listToSlice: List<Int>, startIndex: Int, endIndex: Int): List<Int> {

    return listToSlice.subList(startIndex, endIndex)
}