BitTorrent Interview Question: Implement 2 functions, is_pal... | Glassdoor

## Interview Question

QA Automation Engineer Interview San Francisco, CA

# Implement 2 functions, is_palindrome() and max_int(). The

first function returns True if the given string is a palindrome, and False if not. The second function returns the largest integer that is (1) the product of two 3 digit integers, and (2) is a palindrome.
Tags:
coding

0

/**
* method checks if given word is a palindrome
* @param word
* @return true if word is palindrome, false otherwise
*/
public boolean is_palindrome (String word) {
if (word == null) return false;
word = word.toLowerCase();
int i = 0;
int j = word.length() - 1;
while (i maxpal) {
if (is_palindrome(&quot;&quot; + prod)) {
num++;
System.out.println(num + &quot;:\t &quot; + i + &quot; * &quot; + j + &quot; = &quot; + prod);
maxpal = prod;
}
}
}
}
return maxpal;
}

max_palindrome called with parameters start = 101 and end = 999 will return 906609 as the largest such integer (= 913 * 993).

Christine on Jul 31, 2013