- 博客(14)
- 收藏
- 关注
原创 leetcode13题解
leetcode 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. 题目要求把罗马数字化为整数。解题思路首先要了解罗马数字的规则,见下图: 更多内容可以参考wiki了解了规则以后,我们再
2017-07-12 23:49:34
661
1
原创 leetcode217题解
leetcode 217. Contains Duplicate题目Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should
2017-07-12 21:59:54
453
1
原创 leetcode242题解
leetcode 242. Valid Anagram题目Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return fals
2017-07-10 17:11:43
839
原创 leetcode237题解
leetcode 237. Delete Node in a Linked List题目Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and
2017-07-10 15:01:32
1521
1
原创 leetcode169题解
leetcode 169. Majority Element题目Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty
2017-07-10 11:14:08
424
原创 leetcode387题解
leetcode 387. First Unique Character in a String题目Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1. Examples:s = "leetcode"return 0.
2017-06-24 15:02:22
413
原创 leetcode122题解
leetcode 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
2017-06-05 18:18:50
1248
原创 leetcode283题解
leetcode 283.Move Zeroes题目Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 1
2017-06-05 00:18:00
351
原创 leetcode371题解
leetcode 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: Given a = 1 and b = 2, return 3. 题目意思是:在不使用+和-运算的情况下,求两个整数的和。
2017-06-04 19:52:44
248
原创 leetcode104题解
leetcode 104.Maximum Depth of Binary Tree题目Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
2017-06-04 13:22:53
762
原创 leetcode136题解
leetcode 136.Single Number题目Given an 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 imple
2017-06-02 20:25:47
462
原创 leetcode344题解
leetcode344. Reverse String题目Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”. 翻译成中文就是反转一个字符串,给的例子很好理解。解题思路这道题很简单,关键是时间复杂度和空间复杂
2017-05-28 21:44:22
330
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人