/**
 * Given a list of furniture items, the start and end indices, and a new value,
 * modify the elements within the specified range in the list using list slicing.
 *
 * @param furnitureList A list of furniture items
 * @param startIndex The start index to slice the list
 * @param endIndex The end index to slice the list
 * @param newValue The new value to replace the elements in the specified range
 * @return The modified list of furniture items
 *
 * Example:
 * ----------
 * val furnitureList = mutableListOf("chair", "table", "sofa", "bed")
 * val startIndex = 1
 * val endIndex = 3
 * val newValue = "desk"
 *
 * modifyElementsAndListSlicing(furnitureList, startIndex, endIndex, newValue)
 *
 * Output:
 * ----------
 * ["chair", "desk", "desk", "bed"]
 */
fun modifyElementsAndListSlicing(furnitureList: MutableList<String>, startIndex: Int, endIndex: Int, newValue: String): List<String> {

    furnitureList.subList(startIndex, endIndex).fill(newValue)
    return furnitureList
}
/**
 * Given a list of furniture items, the start and end indices, and a new value,
 * modify the elements within the specified range in the list using list slicing.
 *
 * @param furnitureList A list of furniture items
 * @param startIndex The start index to slice the list
 * @param endIndex The end index to slice the list
 * @param newValue The new value to replace the elements in the specified range
 * @return The modified list of furniture items
 *
 * Example:
 * ----------
 * val furnitureList = mutableListOf("chair", "table", "sofa", "bed")
 * val startIndex = 1
 * val endIndex = 3
 * val newValue = "desk"
 *
 * modifyElementsAndListSlicing(furnitureList, startIndex, endIndex, newValue)
 *
 * Output:
 * ----------
 * ["chair", "desk", "desk", "bed"]
 */
fun modifyElementsAndListSlicing(furnitureList: MutableList<String>, startIndex: Int, endIndex: Int, newValue: String): List<String> {
/**
 * Given a list of furniture items, the start and end indices, and a new value,
 * modify the elements within the specified range in the list using list slicing.
 *
 * @param furnitureList A list of furniture items
 * @param startIndex The start index to slice the list
 * @param endIndex The end index to slice the list
 * @param newValue The new value to replace the elements in the specified range
 * @return The modified list of furniture items
 *
 * Example:
 * ----------
 * val furnitureList = mutableListOf("chair", "table", "sofa", "bed")
 * val startIndex = 1
 * val endIndex = 3
 * val newValue = "desk"
 *
 * modifyElementsAndListSlicing(furnitureList, startIndex, endIndex, newValue)
 *
 * Output:
 * ----------
 * ["chair", "desk", "desk", "bed"]
 */
fun modifyElementsAndListSlicing(furnitureList: MutableList<String>, startIndex: Int, endIndex: Int, newValue: String): List<String> {

    furnitureList.subList(startIndex, endIndex).fill(newValue)
    return furnitureList
}