Advertisement
bai_onzi

symmetricArrays.js

Apr 5th, 2023 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let arrays = gets();
  2. let isSymmetric = false;
  3.  
  4. for(let i = 0; i < arrays; i++){
  5.     let arr = gets().split(' ').map(Number)
  6.     for(let j = 0; j < arr.length; j++){
  7.         if(arr[j] === arr[arr.length - 1 - j]){
  8.             isSymmetric = true;
  9.         }else{
  10.             isSymmetric = false;
  11.             break;
  12.         }
  13.     }
  14.     if(isSymmetric){
  15.         console.log('Yes');
  16.     }else{
  17.         console.log('No');
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement