A simple blog built by Django
LeetCode 每日一题 680. 验证回文串 II
| Published by rcdfrd 680. 验证回文串 II
难度 简单
Input: "abca"
Output: True
Explanation: You could delete the character 'c'.
题目描述:可以删除一个字符,判断是否能构成回文字符串。
所谓的回文字符串,是指具有左右对称特点的字符串,例如 "abcba" 就是一个回文字符串。
使用双指针可以很容易判断一个字符串是否是回文字符串:令一个
Read more ⟶
LeetCode 每日一题 345. 反转字符串中的元音字母
| Published by rcdfrd 345. 反转字符串中的元音字母
难度简单
Given s = "leetcode", return "leotcede".
使用双指针,一个指针从头向尾遍历,一个指针从尾到头遍历,当两个指针都遍历到元音字符时,交换这两个元音字符。
为了快速判断一个字符是不是元音字符,我们将全部元音字符添加到集合 HashSet 中,从而以 O(1) 的时间复杂度进行该操作。
时间复杂度为 O(N):只需要遍
Read more ⟶
LeetCode 每日一题 633. 平方数之和
| Published by rcdfrd [633. 平方数之和](https://leetcode.cn/problems/two-sum-ii-input-array-is-sorted/)
Input: 5
Output: True
Explanation: 1 * 1 + 2 * 2 = 5
题目描述:判断一个非负整数是否为两个整数的平方和。
可以看成是在元素为 0~target 的有序数组中查找两个数,使得这两个数的平方和为
Read more ⟶