Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<bits/stdc++.h>
- #define ll long long
- using namespace std;
- bool palindrome(int arr1[],int n){
- int arr2[n]=reverse(arr1 , arr1+n);
- for(int i =0 ,int j=0 ; i<n ,j<n ; i++,j++){
- if (arr1[i] != arr2[j]) return false;
- }
- return true ;
- }
- int main() {
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- int n; cin>>n;
- int arr1[n];
- for(int i =0 ; i<n ; i++){
- cin>>arr1[i];
- }
- palindrome(arr1,n);
- if (palindrome (arr1 ,n )) cout<<"yes";
- else cout<<"no";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement