Advertisement
Guest User

Is Listed Sord ?

a guest
Dec 19th, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getGets = (arr) => {
  2.     let index = 0;
  3.  
  4.     return () => {
  5.         const toReturn = arr[index];
  6.         index += 1;
  7.         return toReturn;
  8.     };
  9. };
  10. // this is the test
  11. const test = [
  12.     '5',
  13.     '1,2,3,2,5',
  14.     '1,2,8,3,9',
  15.     '1,2,2,3,2',
  16.     '1,2,3,4,5',
  17.     '1,2,3,4,5'
  18.    
  19. ];
  20.  
  21. const gets = this.gets || getGets(test);
  22. const print = this.print || console.log;
  23. ////////////////////////////////////////////////////////////////////////////////////
  24. ////////////////////////////////////////////////////////////////////////////////////
  25. ////////////////////////////////////////////////////////////////////////////////////
  26. let N = Number(gets().split(',').map(Number));
  27. for(let i = 1;i <= N;i++){
  28.     let input = gets().split(',').map(Number);
  29.     let bool = true;
  30.     for(let j = 0;j < input.length-1;j++){
  31.         if (input[j] > input[j + 1] ){
  32.             bool = false;
  33.             break;
  34.         }
  35.     }
  36.         console.log(bool);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement