From 7ecce8bf73131d10e5e2ddd578cdfdae662324f8 Mon Sep 17 00:00:00 2001 From: Vidhi Jain Date: Mon, 14 Oct 2019 23:28:17 +0530 Subject: [PATCH 1/2] #9 solution leetcode --- Solution.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Solution.java diff --git a/Solution.java b/Solution.java new file mode 100644 index 0000000..20b7679 --- /dev/null +++ b/Solution.java @@ -0,0 +1,27 @@ +class Solution { + public boolean isPalindrome(int x) { + if(x<0) + return false; + /*if(x%10==0 && x!=0) + return false;*/ + int ans = 0; + int t = x; + int p = 0; + while(x!=0){ + p++; + x/=10; + } + p--; + x= t; + while(x!=0){ + int d = x%10; + ans = ans + (int)Math.pow(10,p--)*d; + x = x/10; + //p++; + } + if(ans==t) + return true; + else + return false; + } +} \ No newline at end of file From 2a4ab14b98effeeb67bf8108950904cc612b500b Mon Sep 17 00:00:00 2001 From: Vidhi Jain Date: Mon, 14 Oct 2019 23:32:35 +0530 Subject: [PATCH 2/2] #27 solution --- RemoveElement.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 RemoveElement.java diff --git a/RemoveElement.java b/RemoveElement.java new file mode 100644 index 0000000..4fd2b22 --- /dev/null +++ b/RemoveElement.java @@ -0,0 +1,22 @@ +class RemoveElement { + public int removeElement(int[] nums, int val) { + int count = 0; + for(int i = 0;i