SHARE
TWEET

Untitled

a guest Nov 19th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var input = [
  2.     '1 2 3 4 4 3 2 1'
  3. ];
  4.  
  5. var print = this.print || console.log;
  6. var gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  7.  
  8. let array = gets().split(" ").map(Number);
  9. let array1 = [];
  10. let array2 = [];
  11.  
  12. for(let i = 0; i < array.length / 2; i++) {
  13.     array1.push(array[i]);
  14. }
  15.  
  16. for(let i = array.length -1; i >= array.length / 2; i--){
  17.     array2.push(array[i])
  18. }
  19. let result = 0;
  20. for(let i = 0; i < array1.length; i++) {
  21.     if(array1[i] === array2[i]) {
  22.        result += 1;
  23.     }
  24. }
  25.  
  26. if(result == array1.length) {
  27.     print("Yes");
  28. } else {
  29.     print("No")
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top