LeetCode 面试题 01.02. 判定是否互为字符重排

题目 给定两个字符串 s1 和 s2,请编写一个程序,确定其中一个字符串的字符重新排列后,能否变成另一个字符串。 示例 1: 输入: s1 = "abc", s2 = "bca" 输出: true 示例 2: 输入: s1 = "abc", s2 = "bad" 输出: false 说明: 0 &l...

LeetCode 387. 字符串中的第一个唯一字符

题目 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 示例: s = "leetcode" 返回 0 s = "loveleetcode" 返回 2 提示:你可以假定该字符串只包含小写字母。 解题思路 class Solution: def firstUniq...

LeetCode 3: 无重复字符的最长子串 Longest Substring Without Repeating Characters

题目: 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 Given a string, find the length of the longest substring without repeating characters. 示例 1: 输入: "abcabcbb" 输出: 3...

leetCode解题记录:无重复字符的最长子串(JS,PY,TS版)

目描述: 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: "abcabcbb"输出: 3解释: 因为无重复字符的最长子串是 “abc”,所以其长度为 3。示例 2: 输入: "bbbbb"输出: 1解释: 因为无重复字符的最长子串是 “b”,所以其长度为 1。示...

LeetCode 387: 字符串中的第一个唯一字符 First Unique Character in a String

题目: 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 Given a string, find the first non-repeating character in it and return it's index. If it doesn't exis...

[LeetCode] Read N Characters Given Read4 用Read4来读取N个字符

The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu...

[LeetCode] Read N Characters Given Read4 II - Call multiple times 用Read4来读取N个字符之二 - 多次调用

The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu...

[LeetCode] Longest Substring with At Most Two Distinct Characters 最多有两个不同字符的最长子串

Given a string S, find the length of the longest substring T that contains at most two distinct characters. For example, Given S = “eceba”, T is “ece”...

[LeetCode] Longest Substring with At Most K Distinct Characters 最多有K个不同字符的最长子串

Given a string, find the length of the longest substring T that contains at most k distinct characters. For example, Given s = “eceba”&...

[LeetCode] First Unique Character in a String 字符串第一个不同字符

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0....

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。