/**
 * This exercise focuses on copying elements from a 3D list within a given boundary.
 */
fun copyListWithinBoundary(listOfLists: List<List<Int>>, xStart: Int, xEnd: Int, yStart: Int, yEnd: Int, zStart: Int, zEnd: Int): List<List<Int>> {

    // Initialize an empty list to store the copied elements
    val copiedList = mutableListOf<List<Int>>()

    // Iterate through each sublist in the main list
    for (sublist in listOfLists) {
        // Check if sublist is within the specified x range
        if (xStart <= sublist[0] && sublist[0] <= xEnd) {
            // Check if sublist is within the specified y range
            if (yStart <= sublist[1] && sublist[1] <= yEnd) {
                // Check if sublist is within the specified z range
                if (zStart <= sublist[2] && sublist[2] <= zEnd) {
                    // If sublist satisfies all conditions, append it to the copied list
                    copiedList.add(sublist.toList())
                }
            }
        }
    }

    // Return the copied list containing the elements within the specified boundary
    return copiedList
}
/**
 * This exercise focuses on copying elements from a 3D list within a given boundary.
 */
fun copyListWithinBoundary(listOfLists: List<List<Int>>, xStart: Int, xEnd: Int, yStart: Int, yEnd: Int, zStart: Int, zEnd: Int): List<List<Int>> {
/**
 * This exercise focuses on copying elements from a 3D list within a given boundary.
 */
fun copyListWithinBoundary(listOfLists: List<List<Int>>, xStart: Int, xEnd: Int, yStart: Int, yEnd: Int, zStart: Int, zEnd: Int): List<List<Int>> {

    // Initialize an empty list to store the copied elements
    val copiedList = mutableListOf<List<Int>>()

    // Iterate through each sublist in the main list
    for (sublist in listOfLists) {
        // Check if sublist is within the specified x range
        if (xStart <= sublist[0] && sublist[0] <= xEnd) {
            // Check if sublist is within the specified y range
            if (yStart <= sublist[1] && sublist[1] <= yEnd) {
                // Check if sublist is within the specified z range
                if (zStart <= sublist[2] && sublist[2] <= zEnd) {
                    // If sublist satisfies all conditions, append it to the copied list
                    copiedList.add(sublist.toList())
                }
            }
        }
    }

    // Return the copied list containing the elements within the specified boundary
    return copiedList
}