/**
 * Given a list of integers 'arr', starting index and ending index,
 * return the subarray elements between the start and end indices (inclusive).
 *
 * Example:
 * input:
 * arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
 * start_index = 2
 * end_index = 7
 *
 * output:
 * [6, 8, 10, 12, 14, 16]
 *
 * Note:
 * - The indices are 0-based, so the first element has an index of 0.
 * - Both the start and end indices are included in the resulting subarray.
 */
fun intersectionOfSlicingAndBasicLoopSyntax(arr: List<Int>, startIndex: Int, endIndex: Int): List<Int> {

    // Perform slicing here to extract the subarray
    val subarray = arr.subList(startIndex, endIndex + 1)

    return subarray
}
/**
 * Given a list of integers 'arr', starting index and ending index,
 * return the subarray elements between the start and end indices (inclusive).
 *
 * Example:
 * input:
 * arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
 * start_index = 2
 * end_index = 7
 *
 * output:
 * [6, 8, 10, 12, 14, 16]
 *
 * Note:
 * - The indices are 0-based, so the first element has an index of 0.
 * - Both the start and end indices are included in the resulting subarray.
 */
fun intersectionOfSlicingAndBasicLoopSyntax(arr: List<Int>, startIndex: Int, endIndex: Int): List<Int> {
/**
 * Given a list of integers 'arr', starting index and ending index,
 * return the subarray elements between the start and end indices (inclusive).
 *
 * Example:
 * input:
 * arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
 * start_index = 2
 * end_index = 7
 *
 * output:
 * [6, 8, 10, 12, 14, 16]
 *
 * Note:
 * - The indices are 0-based, so the first element has an index of 0.
 * - Both the start and end indices are included in the resulting subarray.
 */
fun intersectionOfSlicingAndBasicLoopSyntax(arr: List<Int>, startIndex: Int, endIndex: Int): List<Int> {

    // Perform slicing here to extract the subarray
    val subarray = arr.subList(startIndex, endIndex + 1)

    return subarray
}