나는 이렇게 학습한다/Algorithm & SQL

1117. Reverse List Order

daco2020 2022. 11. 17. 23:51
반응형

In this kata you will create a function that takes in a list and returns a list with the reverse order.

Examples (Input -> Output)

* [1, 2, 3, 4]  -> [4, 3, 2, 1]
* [9, 2, 0, 7]  -> [7, 0, 2, 9]



Solution:

List<int> reverseList(List<int> list) {
  return list.reversed.toList();
}
List<int> reverseList(List<int> list)=>[...list.reversed];
List<int> reverseList(List<int> list) => List.from(list.reversed);


반응형