I am having a bit of trouble solving Project Euler question 4. I am inexperienced in programming and didn\'t really understand other answers. I managed to write a code that
for 3 digits loop can be started from 100 to 1000(exclusive).
You can try this ::
int num1 = 0, num2 = 0;
for(int i=100; i<1000; i++){
for(int j=100; j<1000; j++){
String mul = String.valueOf(i*j);
if(isPalindrome(mul)){
num1 = i;
num2 = j;
}
}
}
System.out.println(num1*num2);
Implement palindrome method as :
boolean isPalindrome(String str) {
String strRev = new StringBuilder(str).reverse().toString();
return str.equals(strRev);
}
This works good but take this as reference and improve as needed Thanks