Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers | ||||
| ||||
Ans. public static void main(String[] args){ List<Integer> listOfIntegers = Arrays.asList(1,2,3,4,5,6,7,8,9,10,11); List<Integer> perfectAndPalindromeIntegers = new ArrayList<Integer>(); for(Integer i: listOfIntegers){ if(isPalindrome(i) && isPerfect(i)){ perfectAndPalindromeIntegers.add(i); } } System.out.println(perfectAndPalindromeIntegers); } private static Boolean isPalindrome(Integer i){ String str = String.valueOf(i); char[] charArray = str.toCharArray(); int x = 0; int y = str.length()-1; while(x < y){ if(charArray[x] != charArray[y]){ return false; } } return true; } private static Boolean isPerfect(Integer i){ for(int x=2;x<3;x++){ if(x*x == i){ return true; } } return false; } | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() or What is the difference between String , StringBuilder and StringBuffer ? | ||||
![]() | ||||
![]() or Explain OOPs Principles or Explain OOPs Concepts or Explain OOPs features or Tell me something about OOPs | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||