字串處理

字串處理題型的解題教學,8 題。這類題多半考邊界:空字串、大小寫、非字母字元,每篇都會把這些列出來。

Palindromic Substrings 解題教學示意圖|LeetCode 647

Palindromic Substrings 解題教學:3 種解法完整比較|LeetCode 647 Best Practice

Given 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.

Palindromic Substrings 解題教學:3 種解法完整比較|LeetCode 647 Best Practice Read More »

Leetcode, 技術文章, , ,
Valid Palindrome 解題教學示意圖|LeetCode 125

Valid Palindrome 解題教學:3 種解法完整比較|LeetCode 125 Best Practice

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

Given a string s, return true if it is a palindrome, or false otherwise.

Valid Palindrome 解題教學:3 種解法完整比較|LeetCode 125 Best Practice Read More »

Leetcode, 技術文章, , ,
Minimum Window Substring 解題教學示意圖|LeetCode 76

Minimum Window Substring 解題教學:3 種解法完整比較|LeetCode 76 Best Practice

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string “”.

The testcases will be generated such that the answer is unique.

Minimum Window Substring 解題教學:3 種解法完整比較|LeetCode 76 Best Practice Read More »

Leetcode, 技術文章, , , ,
Longest Substring Without Repeating Characters 解題教學封面|LeetCode 3

Longest Substring Without Repeating Characters 解題教學:3 種解法完整比較|LeetCode 3 Best Practice

Given a string s, find the length of the longest substring without repeating characters.

Longest Substring Without Repeating Characters 解題教學:3 種解法完整比較|LeetCode 3 Best Practice Read More »

Leetcode, 技術文章, , , ,
Word Search 解題教學示意圖|LeetCode 79

Word Search 解題教學:3 種解法完整比較|LeetCode 79 Best Practice

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

Word Search 解題教學:3 種解法完整比較|LeetCode 79 Best Practice Read More »

Leetcode, 技術文章, , ,
Word Break II 解題教學示意圖|LeetCode 140

Word Break II 解題教學:3 種解法完整比較|LeetCode 140 Best Practice

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

Note that the same word in the dictionary may be reused multiple times in the segmentation.

Word Break II 解題教學:3 種解法完整比較|LeetCode 140 Best Practice Read More »

Leetcode, 技術文章, , , ,
Word Break 解題教學示意圖|LeetCode 139

Word Break 解題教學:3 種解法完整比較|LeetCode 139 Best Practice

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

Note that the same word in the dictionary may be reused multiple times in the segmentation

Word Break 解題教學:3 種解法完整比較|LeetCode 139 Best Practice Read More »

Leetcode, 技術文章, , , ,