Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- let collection = input.map(arr=>{
- let singleArr = JSON.parse(arr);
- singleArr.map(Number);
- singleArr.sort((a,b)=>{
- return b-a;
- });
- return JSON.stringify(singleArr);
- });
- let uniqueSet = new Set(collection);
- let output = Array.from(uniqueSet);
- output
- .map(JSON.parse)
- .sort((a,b)=>{
- return a.length - b.length;
- })
- .forEach(el=>console.log(`[${el.join(', ')}]`));
- }
Advertisement
Add Comment
Please, Sign In to add comment