MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / palinArray

Method palinArray

PalindromicArray.java:1–22  ·  view source on GitHub ↗
(int[] a, int n)

Source from the content-addressed store, hash-verified

1 public static int palinArray(int[] a, int n)
2 {
3 //add code here.
4// Traverse all array elements one by one
5 for(int num: a)
6 {
7// Convert array element to string
8 String number = String.valueOf(num);
9// Get the first and last index
10 int i=0;
11 int j=number.length()-1;
12// Check if element is palindrome or not
13 while(i<j)
14 {
15 if(number.charAt(i)!=number.charAt(j))
16 return 0;
17 i++;j--;
18 }
19
20 }
21 return 1;
22 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected