We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bff0c73 + cb4aa14 commit ad6c40fCopy full SHA for ad6c40f
typescript/9-Palindrom-Number.ts
@@ -0,0 +1,13 @@
1
+var isPalindrome = (x: number) => {
2
+ // Creates array from int characters
3
+ // 121 -> [1,2,1]
4
+ let arr = Array.from(String(x), Number);
5
+
6
+ // Uses two pointer
7
+ for (let i = 0; i < arr.length; i++) {
8
+ if (arr[i] !== arr[arr.length - 1 - i]) {
9
+ return false;
10
+ }
11
12
+ return true;
13
+};
0 commit comments