티스토리 뷰

공부

[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

'공부' 카테고리의 다른 글

[HBASE] basic  (0) 2021.12.21
[Java] Heap (add & peek & poll)  (0) 2021.12.20
[Java] Array stream max  (0) 2021.12.19
[Spark] Partition Pruning & Predicate Pushdown  (0) 2021.12.19
[DBMS] Row Oriented vs Column Oriented  (0) 2021.12.19
댓글