Advertisement
CR7CR7

DuplicateNumbers

Feb 10th, 2022
857
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //let input =['c','c','a','b','a','a','b','c'];
  2. let input =['1','2','2','2','2','18','3','12'];
  3. let print = this.print || console.log;
  4. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  5.  
  6. let resultArr =[];
  7. for (let i = 0 ;i< input.length;i++) {
  8.     let element =gets();
  9.     if(resultArr.includes(element)){
  10.         continue;
  11.     }
  12.    resultArr.push(element);
  13.    
  14. }
  15. print(resultArr.toString());
  16.  
Advertisement
RAW Paste Data Copied
Advertisement