공부
[Java] Palindrome
승가비
2021. 12. 20. 06:40
728x90
private boolean check(String s, int left, int right) {
while (left <= right) {
if (s.charAt(left) != s.charAt(right)) {
return false;
}
left++;
right--;
}
if (left >= right) {
return true;
}
return false;
}
https://leetcode.com/problems/valid-palindrome-ii/submissions/
Valid Palindrome II - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
728x90