字符串数组中的典型习题有哪些?

2026-05-23 15:031阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计788个文字,预计阅读时间需要4分钟。

字符串数组中的典型习题有哪些?

1. 字符串 + 转换为大写/小写 - 题目链接:[https://leetcode-cn.com/problems/to-lower-case/](https://leetcode-cn.com/problems/to-lower-case/) - 题目描述:将字符串中的所有大写字母转换为小写字母。

2. 字符串 + 获取最后一个单词的长度 - 题目链接:[https://leetcode-cn.com/problems/length-of-last-word/](https://leetcode-cn.com/problems/length-of-last-word/) - 题目描述:给定一个字符串,返回最后一个单词的长度。

3. 字符串 + 宝石与石头 - 题目链接:[https://leetcode-cn.com/problems/jewels-and-stones/](https://leetcode-cn.com/problems/jewels-and-stones/) - 题目描述:给定字符串 jewels 表示你可以收集到的宝石类型,和字符串 stones 表示你拥有的石头。返回你最多能收集的宝石数量。

4. 字符串 + 第一个唯一字符 - 题目链接:[https://leetcode-cn.com/problems/first-unique-character-in-a-string/](https://leetcode-cn.com/problems/first-unique-character-in-a-string/) - 题目描述:在字符串 s 中找到第一个只出现一次的字符,并返回它的索引。如果不存在,则返回 -1。

阅读全文

本文共计788个文字,预计阅读时间需要4分钟。

字符串数组中的典型习题有哪些?

1. 字符串 + 转换为大写/小写 - 题目链接:[https://leetcode-cn.com/problems/to-lower-case/](https://leetcode-cn.com/problems/to-lower-case/) - 题目描述:将字符串中的所有大写字母转换为小写字母。

2. 字符串 + 获取最后一个单词的长度 - 题目链接:[https://leetcode-cn.com/problems/length-of-last-word/](https://leetcode-cn.com/problems/length-of-last-word/) - 题目描述:给定一个字符串,返回最后一个单词的长度。

3. 字符串 + 宝石与石头 - 题目链接:[https://leetcode-cn.com/problems/jewels-and-stones/](https://leetcode-cn.com/problems/jewels-and-stones/) - 题目描述:给定字符串 jewels 表示你可以收集到的宝石类型,和字符串 stones 表示你拥有的石头。返回你最多能收集的宝石数量。

4. 字符串 + 第一个唯一字符 - 题目链接:[https://leetcode-cn.com/problems/first-unique-character-in-a-string/](https://leetcode-cn.com/problems/first-unique-character-in-a-string/) - 题目描述:在字符串 s 中找到第一个只出现一次的字符,并返回它的索引。如果不存在,则返回 -1。

阅读全文