- 博客(14)
- 收藏
- 关注
原创 942. DI String Match
Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length.Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1:If S[i] == "I", then A[i] < A...
2018-11-27 10:11:40
520
原创 908.Smallest Range I
Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i].After this process, we have some array B.Return the smallest possible difference ...
2018-11-07 20:11:04
231
原创 929. Unique Email Address
If you add a plus ('+') in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered, for example m.y+name@email.com will be forwarded to my@email...
2018-11-07 19:46:34
830
原创 922. Sort Array By Partity II
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is...
2018-11-02 10:41:38
236
原创 852.Peak Index in a Mountain Array
Let's call an array A a mountain if the following properties hold:A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ....
2018-11-02 09:11:58
200
原创 728. Self-Dividing-Numbers
A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.Also, a self-dividin...
2018-11-01 21:19:42
216
原创 709. To Lower Case
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1:Input: "Hello"Output: "hello"Example 2:Input: "here"Output: "here"...
2018-10-29 15:21:19
192
原创 136. Single Number
Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us...
2018-10-26 13:45:24
161
原创 7. Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dea...
2018-10-25 19:43:11
149
原创 718. Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1:Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Output: 3Explanation: The repeated subarray...
2018-01-24 15:15:06
256
原创 72. Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:...
2018-01-22 14:47:04
374
原创 712. Minimum ASCII Delete Sum for Two Strings
Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 = "eat"Output: 231Explanation: Deleting "s" from "sea" adds t...
2018-01-20 21:23:16
214
原创 413. Arithmetic Slices
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmetic sequence:...
2018-01-18 09:05:43
222
原创 647. Palindromic Substrings
Problem description: Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrin...
2018-01-18 08:45:58
272
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人