【leetcode】 Jump Game II
地址
题目
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps. For example: Given array A = [2,3,1,1,4] The minimum number of jumps to reach the last index is 2. (Jump 1 step from index 0 to 1, then 3 steps to the last index.) Note: You can assume that you can always reach the last index.
【leetcode】 Wildcard Matching
地址
https://leetcode.com/problems/wildcard-matching/description/
题目
Implement wildcard pattern matching with support for '?' and ''. '?' Matches any single character. '' Matches any sequence of characters (including the empty sequence). The matching should cover the entire input string (not partial). The function prototype should be: bool isMatch(const char s, const char p) Some examples: isMatch("aa","a") → false isMatch("aa","aa") → true isMatch("aaa","aa") → false isMatch("aa", "") → true isMatch("aa", "a") → true isMatch("ab", "?") → true isMatch("aab", "ca*b") → false
【leetcode】 Trapping Rain Water
地址
https://leetcode.com/problems/trapping-rain-water/description/
题目
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for contributing this image!
【leetcode】 First Missing Positive
地址
https://leetcode.com/problems/first-missing-positive/description/
题目
Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant space.
【leetcode】 Sudoku Solver
【leetcode】 Longest Valid Parentheses
地址
https://leetcode.com/problems/longest-valid-parentheses/description/
题目
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()", which has length = 2. Another example is ")()())", where the longest valid parentheses substring is "()()", which has length = 4.
【hihocoder】 1718 最长一次上升子序列
【hihocoder】 1717 hiho字符串3
地址
题目
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 我们定义第一代hiho字符串是"h"。第N代hiho字符串是由第N-1代hiho字符串变化得到,规则是在每一个h后插入i,i后插入o,o后插入h。 例如第二、三、四代hiho字符串分别是: "hi"、"hiio"和"hiioiooh"。 给定K,请你计算第100代hiho字符串中的第K个字符是什么。
输入 第一行包含一个整数T,代表测试数据的组数。 (1 ≤ T ≤ 10)
以下T行每行包含一个整数K。
对于50%的数据,1 ≤ K ≤ 1000000 对于100%的数据, 1 ≤ K ≤ 1000000000000000输出 对于每组数据,输出一行,包含一个字符代表答案。
样例输入 2
3
7 样例输出 i
o
【leetcode】 Substring with Concatenation of All Words
地址
https://leetcode.com/problems/substring-with-concatenation-of-all-words/description/
题目
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.
For example, given: s: "barfoothefoobarman" words: ["foo", "bar"]
You should return the indices: [0,9]. (order does not matter).