-
给定一组区间,对于每一个区间 i,检查是否存在一个区间 j,它的起始点大于或等于区间 i 的终点,这可以称为 j 在 i 的“右侧”。
对于任何区间,你需要存储的满足条件的区间 j 的最小索引,这意味着区间 j 有最小的起始点可以使其成为“右侧”区间...
-
给定一个字符串 s 和一个非空字符串 p,找到 s 中所有是 p 的字母异位词的子串,返回这些子串的起始索引。字符串只包含小写英文字母,并且字符串 s 和 p 的长度都不超过 20100。
说明:
字母异位词指字母相同,但排列不同的字符串。不考虑答案...
-
给你一个字符串 S、一个字符串 T,请在字符串 S 里面找出:包含 T 所有字母的最小子串。
1234567输入: S = "ADOBECODEBANC", T = "ABC"输出: "BANC&...
-
给定整数 n 和 k,找到 1 到 n 中字典序第 k 小的数字。注意:1 ≤ k ≤ n ≤ 109。
示例 :
123456输入:n: 13 k: 2输出:10解释:字典序的排列是 [1, 10, 11, 12, 13, 2, 3, 4, 5...
-
你总共有 n 枚硬币,你需要将它们摆成一个阶梯形状,第 k 行就必须正好有 k 枚硬币。给定一个数字 n,找出可形成完整阶梯行的总行数。n 是一个非负整数,并且在32位有符号整型的范围内。
1234567示例 1:n = 5硬币可排列成以下几行:¤¤...
-
如果一个数列至少有三个元素,并且任意两个相邻元素之差相同,则称该数列为等差数列。例如,以下数列为等差数列:
1231, 3, 5, 7, 97, 7, 7, 73, -1, -5, -9
以下数列不是等差数列。
11, 1, 2, 5, 7
...
-
Consider the string s to be the infinite wraparound string of “abcdefghijklmnopqrstuvwxyz”, so s will look like this: “…zabcd...
-
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water.
Grid cells are ...
-
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Given two...
-
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the subs...