The FIFO behavior implies that the first element is the first to be processed; in LIFO, the first element is processed last. Transform the original list so that it satisfies the LIFO contract by looping through it sequentially from the first element to the last.
Ordering elements in collection
Application
Report a typo
Sample Input 1:
blue red orange blackSample Output 1:
[black, orange, red, blue]Write a program in Kotlin
fun main() {
val list = readln().split(" ")
// write your code here
val res =
println(res)
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.