Menu
Coddy logo textTech

Check Palindrome

Lesson 20 of 26 in Coddy's Arrays in C++ course.

challenge icon

Challenge

Check whether the given array is a palindrome or not.

Palindromes are those which are the same when read from first to last and last to first.

For Example,

int A[]={1,2,3,2,1}
int B[]={5,6,2,3,5}

Here, A is a palindrome because even if we read the array from last to first or first to

last, it is same

In the case of B, it is not seen.

 

Complete the function palindrome, return true if the array is palindrome else return false.

Try it yourself

#include<iostream>
using namespace std;
#include<vector>

bool palindrome(vector<int>arr, int n){
      
       //Code here
     
}

All lessons in Arrays in C++