Previous Next
0 / 21
Module DEMO-32-106DEMO-C-32

Palindrome Array

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a C program to check if an array is a palindrome. An array is a palindrome if it reads the same forward and backward. Output "YES" if it is a palindrome, otherwise "NO".

Example 1

Input:

5 1 2 3 2 1

Output:

YES

Example 2

Input:

4 1 2 3 4

Output:

NO

Constraints

1 <= n <= 100

Input Format

n and array

Output Format

YES or NO

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5
1 2 3 2 1
YES
1=1, 2=2.
Sample #2
Public sample
4
1 2 3 4
NO
1!=4.
Sample #3
Public sample
1
5
YES
Single el is palindrome.
Sample #4
Public sample
2
1 1
YES
Two identical.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings