Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions RemoveElement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class RemoveElement {
public int removeElement(int[] nums, int val) {
int count = 0;
for(int i = 0;i<nums.length;i++){
if(nums[i]!=val)
count++;
}
int i = 0;
int j = nums.length - 1;
while(i<=j){
if(nums[i]==val){
int t = nums[i];
nums[i] = nums[j];
nums[j] = t;
j--;
}else{
i++;
}
}
return count;
}
}
27 changes: 27 additions & 0 deletions Solution.java
Original file line number Diff line number Diff line change
@@ -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;
}
}