Loading [Contrib]/a11y/accessibility-menu.js
Back
Close

Mirror

aziiz97
635 views

import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main {
public static void main(String[] args) { List data=new ArrayList(){{ add(-8); add(42); add(18); add(0); add(-16); }}; List res=new ArrayList(data); int n=data.size(); Collections.sort(res); for (int i = n - 2; i >= 0; --i) res.add(res.get(i)); for (Integer element : data) System.out.print(element+" "); System.out.println("\n resultat :"); for (Integer element : res) System.out.print(element+" ");;

}

}

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants