From 7391a5ff56688ee6d5aec69767eb96690b13935a Mon Sep 17 00:00:00 2001 From: Samarth484 <59834694+Samarth484@users.noreply.github.com> Date: Sat, 18 Apr 2020 22:22:02 +0530 Subject: [PATCH] saving redundant memory occupation. No point in intialising variables to single digit numbers and later comparing when you could have directly returned the judgement then and there! --- src/problems/easy/PalindromeNumber.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/problems/easy/PalindromeNumber.java b/src/problems/easy/PalindromeNumber.java index 46b7d0a..66bef96 100644 --- a/src/problems/easy/PalindromeNumber.java +++ b/src/problems/easy/PalindromeNumber.java @@ -1,4 +1,4 @@ -package problems.easy; +9package problems.easy; /** * Created by sherxon on 1/11/17. @@ -9,7 +9,7 @@ public static void main(String[] args) { } static boolean isPalindrome(int x) { - if (x == 0) return true; + if (x>=0 && x<=9) return true; if (x < 0) return false; int xx = x; int m = x % 10;