- 博客(7)
- 收藏
- 关注
原创 121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi
2016-09-04 16:51:01
209
原创 258 Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, r
2016-08-02 20:08:51
197
原创 20 Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “
2016-08-02 20:01:49
205
原创 13 Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.class Solution { public: int romanToInt(string s) { map<char,int> romanToIntMap {
2016-08-02 19:46:44
261
原创 9 Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. 不明白 Do this without extra space. 是什么意思,但是 submit 成功了。//思路:反转 x 存储到 rev 中,然后直接比较原值与反转的数字。 class Solution { public: bool is
2016-08-02 19:38:07
194
原创 1 Two sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example: Given nums = [2, 7, 11,
2016-08-02 19:25:21
194
原创 7 Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321click to show spoilers.Have you thought about this? Here are some good questions to ask before coding. Bonus
2016-08-02 19:19:53
213
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅