Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Palindrome Number C#

Copy
public class Solution {
    public bool IsPalindrome(int x) {
        string first = x.ToString();             //turn to string (easy to reverse)
        char[] charArr = first.ToCharArray();   //the original target
        char[] reverseArr = first.ToCharArray();   

        Array.Reverse(reverseArr );                 
     
        return charArr.SequenceEqual(reverseArr); //compare two array
    }
}
Source by zyrastory.com #
 
PREVIOUS NEXT
Tagged: #Palindrome #Number
ADD COMMENT
Topic
Name
6+7 =