LeetCode 5: Longest Palindromic Substring in Java
· One min read
Every palindrome has a center. Expand around each character for odd-length palindromes and around each adjacent pair for even-length palindromes.
Every palindrome has a center. Expand around each character for odd-length palindromes and around each adjacent pair for even-length palindromes.
The direct approach merges both sorted arrays and selects the middle value. It is simple and runs in O(m+n) time.
Use a sliding window whose left boundary always remains after the previous occurrence of the current character.
Each linked list stores a non-negative integer in reverse digit order. Add corresponding nodes and return the sum in the same representation.
Given an integer array nums and an integer target, return the indexes of two distinct elements whose sum equals the target.