LeetCode 솔루션 분류
[5/22] 647. Palindromic Substrings
본문
[LeetCode 시즌 3] 2022년 5월 22일 문제입니다.
https://leetcode.com/problems/palindromic-substrings/
647. Palindromic Substrings
Medium
7065161Add to ListShareGiven a string s
, return the number of palindromic substrings in it.
A string is a palindrome when it reads the same backward as forward.
A substring is a contiguous sequence of characters within the string.
Example 1:
Input: s = "abc" Output: 3 Explanation: Three palindromic strings: "a", "b", "c".
Example 2:
Input: s = "aaa" Output: 6 Explanation: Six palindromic strings: "a", "a", "a", "aa", "aa", "aaa".
Constraints:
1 <= s.length <= 1000
s
consists of lowercase English letters.
관련자료
-
링크
댓글 3
mingki님의 댓글
- 익명
- 작성일
C++
Runtime: 15 ms, faster than 54.90% of C++ online submissions for Palindromic Substrings.
Memory Usage: 7.6 MB, less than 47.94% of C++ online submissions for Palindromic Substrings.
Runtime: 15 ms, faster than 54.90% of C++ online submissions for Palindromic Substrings.
Memory Usage: 7.6 MB, less than 47.94% of C++ online submissions for Palindromic Substrings.