Azienda coinvolta
Write a function to determain if a string is Palindrome?
Anonimo
use two pointer left and right in a while loop. check whether char at left equals to right. if yes, left++ and right--, if not, return false.
public static boolean isPalindrome(String text, int start, int end){ if (text == null) { return false; } if (start >= end) { return true; } if (text.charAt(start) != text.charAt(end)) { return false; } return isPalindrome(text,start+1,end-1); }
Non lasciarti sfuggire opportunità e informazioni privilegiate seguendo le aziende dove vorresti lavorare.
Ricevi suggerimenti e aggiornamenti personalizzati avviando le tue ricerche.