Ordenar por maximo en Julia
This commit is contained in:
16
src/Julia/002.jl
Normal file
16
src/Julia/002.jl
Normal file
@@ -0,0 +1,16 @@
|
||||
function order_by_max(lst)
|
||||
return sort(lst, by=maximum)
|
||||
end
|
||||
|
||||
|
||||
check = [[3,2],[6,7,5],[1,4]]
|
||||
println(order_by_max(check)) # [[3,2],[1,4],[6,7,5]]
|
||||
|
||||
check = [[1],[0,1]]
|
||||
println(order_by_max(check)) # [[1],[0,1]]
|
||||
|
||||
check = [[0,1],[1]]
|
||||
println(order_by_max(check)) # [[0,1],[1]]
|
||||
|
||||
check = ["este","es","el","primero"]
|
||||
println(order_by_max(check)) # ["el","primero","es","este"]
|
||||
Reference in New Issue
Block a user