Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [4,1,4,-1,2]
- [3,4,4,-1,2]
- [3,2,4,-1,2]
- [3,1,4, 2,2]
- [] -> []
- [1] -> [1]
- [1,2] -> [2,2]
- [2,1] -> [2,1]
- [4,4,4,4] -> [4,4,4,4]
- [-1,-3,-10] -> [-1,-3,-10]
- [1,3,10] -> [3,3,10] [10,3,10] [1,10,10]
- [1,1,2,1] -> [2,1,2,1] [1,2,2,1]
- [998,64,2,-94,-789] -> [998,64,2,-94,-789]
- [998,2,64,-94,-789] -> [998,64,64,-94,-789]
- [3,1,4,-1,2] -> [4,1,4,-1,2] [3,4,4,-1,2] [3,2,4,-1,2] [3,1,4,2,2]
- [-1,4,0,4,7,2,3] -> [4,4,0,4,7,2,3] [0,4,0,4,7,2,3] [-1,4,4,4,7,2,3] [7,4,0,4,7,2,3] [-1,7,0,4,7,2,3] [-1,4,7,4,7,2,3] [-1,4,0,7,7,2,3] [2,4,0,4,7,2,3] [-1,4,2,4,7,2,3] [3,4,0,4,7,2,3] [-1,4,3,4,7,2,3] [-1,4,0,4,7,3,3]
- [3542,-12311,7662,1672,6081] -> [7662,-12311,7662,1672,6081] [3542,7662,7662,1672,6081] [3542,1672,7662,1672,6081] [6081,-12311,7662,1672,6081] [3542,6081,7662,1672,6081] [3542,-12311,7662,6081,6081]
- x=>x.reduceRight((p,c)=>[c<m&&d?(d=0,m):m=c,...p],[],d=m=-1/0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement