- 博客(30)
- 资源 (11)
- 问答 (1)
- 收藏
- 关注
原创 541. Reverse String II
Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them...
2018-12-30 21:24:18 118
原创 917. Reverse Only Letters :先逆序再插入 c.isalpha() and reversed(String)
Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions. Example 1:Input: "ab-cd"Output: "dc-b...
2018-12-30 19:33:34 239
原创 953. Verifying an Alien Dictionary
In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.Given a sequence ...
2018-12-30 14:19:48 330
原创 371. Sum of Two Integers 负数不行 ?
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example 1:Input: a = 1, b = 2Output: 3Example 2:Input: a = -2, b = 3Output: 1 cl...
2018-12-30 13:52:38 248
原创 389. Find the Difference 用list的方法strip()隔断字符串判断list长度来确定差别字符
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was adde...
2018-12-26 22:49:37 132
原创 13. Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...
2018-12-26 22:17:34 79
原创 557. Reverse Words in a String III 去掉字符串首尾空格方法object.strip()
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contest"...
2018-12-26 21:31:52 158
原创 884. Uncommon Words from Two Sentences 用collections模块里的Counter类对象计数,返回字典中的key
We are given two sentences A and B. (A sentence is a string of space separated words. Each wordconsists only of lowercase letters.)A word is uncommon if it appears exactly once in one of the sente...
2018-12-25 23:21:16 155
原创 961. N-Repeated Element in Size 2N Array 集合+求和减法
In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times.Return the element repeated N times. Example 1:Input: [1,2,3,3]Output: 3Examp...
2018-12-25 22:24:03 119
原创 893. Groups of Special-Equivalent Strings
You are given an array A of strings.Two strings S and T are special-equivalent if after any number of moves, S == T.A move consists of choosing two indices i and j with i % 2 == j % 2, and swappin...
2018-12-19 22:04:59 124
原创 868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.If there aren't two consecutive 1's, return 0. Example 1:...
2018-12-16 20:00:01 121
原创 922. Sort Array By Parity 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...
2018-12-15 22:27:49 100
原创 561. Array Partition I 先有序,再求第0,2,4...n-1位置的和
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as p...
2018-12-15 21:17:27 87
原创 728. Self Dividing Numbers [for ...else]
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-divi...
2018-12-15 20:58:59 134
原创 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type o...
2018-12-13 23:46:46 81
原创 67. Add Binary 二进制转换10进制加法再转换回去
Given two binary strings, return their sum (also a binary string).The input strings are both non-empty and contains only characters 1 or 0.Example 1:Input: a = "11", b = "1"Output: "100"E...
2018-12-13 22:34:15 162
原创 258. Add Digits 【递归】
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.Example:Input: 38Output: 2 Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2. ...
2018-12-13 22:15:48 92
原创 717. 1-bit and 2-bit Characters
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).Now given a string represented by several bits. Re...
2018-12-13 21:29:34 109
原创 942. DI String Match 越界错误因为空表,索引0不存在
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-12-12 21:50:23 134
原创 617. Merge Two Binary Trees 【递归调用】
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree...
2018-12-12 21:12:42 123
原创 461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x, y &...
2018-12-12 20:48:17 163
原创 832. Flipping(翻转) an Image
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the image is reversed. For ex...
2018-12-12 20:35:45 202
原创 944. Delete Columns to Make Sorted 【?】
We are given an array A of N lowercase letter strings, all of the same length.Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices...
2018-12-12 19:38:26 122
原创 118. Pascal's triangle out of range
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly above it.Example:Input: 5Output:...
2018-12-11 22:09:38 140
原创 122. Best Time to Buy and Sell Stock II 超时解决
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy...
2018-12-11 20:21:16 118
原创 944. Delete Columns to Make Sorted
We are given an array A of N lowercase letter strings, all of the same length.Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices. The...
2018-12-04 22:15:50 130
原创 905. Sort Array By Parity
Given an array A of non-negative integers, return an array consisting of all the even(偶数) elements of A, followed by all the odd(奇数) elements of A.You may return any answer array that satisfies this...
2018-12-03 21:12:00 86
原创 804. Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.F
2018-12-02 13:53:28 164
原创 929. Unique Email Addresses and 709. To Lower Case
Every email consists of a local name and a domain name, separated by the @ sign.For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name.Besides lowercase l...
2018-12-02 11:25:03 377
原创 771. Jewels and Stones
You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the sto...
2018-12-02 10:04:01 117
我的计算机适用的WindowsXP下触控板驱动程序
2010-10-16
sqlplus / as sysdba却连不上数据库
2014-11-23
TA创建的收藏夹 TA关注的收藏夹
TA关注的人