leetcode刷题
your_blue_sky
这个作者很懒,什么都没留下…
展开
-
leetcode题记:Implement strStr()
题目描述:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Exa...原创 2018-07-08 14:30:55 · 104 阅读 · 0 评论 -
leetcode题记:Maximum Depth of Binary Tree
编程语言:JAVA题目描述: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.Note: A leaf is a ...原创 2018-07-31 22:00:10 · 135 阅读 · 0 评论 -
leetcode题记:Symmetric Tree
编程语言:JAVA题目描述:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 /...原创 2018-07-31 20:56:47 · 112 阅读 · 0 评论 -
leetcode题记:Same Tree
编程语言:JAVA题目描述:Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the s...原创 2018-07-30 22:03:54 · 129 阅读 · 0 评论 -
leetcode题记:Merge Sorted Array
编程语言:JAVA题目描述:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively....原创 2018-07-30 20:27:56 · 137 阅读 · 0 评论 -
leetcode题记:Climbing Stairs
编程语言:JAVA 题目描述:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given...原创 2018-07-30 11:37:29 · 146 阅读 · 0 评论 -
leetcode题记:Sqrt(x)
编程语言:JAVA题目描述:Implement int sqrt(int x).Compute and return the square root of x, where x is guaranteed to be a non-negative integer.Since the return type is an integer, the decimal digits are ...原创 2018-07-29 21:45:29 · 160 阅读 · 0 评论 -
leetcode题记:Maximum Subarray
编程语言:JAVA题目描述:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Ou...原创 2018-07-15 22:21:46 · 137 阅读 · 0 评论 -
leetcode题记:Plus One
编程语言:JAVA题目描述:Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list...原创 2018-07-19 20:32:27 · 151 阅读 · 0 评论 -
leetcode题记:Add Binary
编程语言:JAVA题目描述: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"...原创 2018-07-23 22:06:30 · 132 阅读 · 0 评论 -
leetcode题记:Length of Last Word
编程语言:JAVA题目描述:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.N...原创 2018-07-17 23:20:16 · 185 阅读 · 0 评论 -
leetcode题记:Count and Say
编程语言:JAVA提交结果:Submission Detail18 / 18 test cases passed.Status: AcceptedRuntime: 41 msSubmitted: 0 minutes agoYou are here! Your runtime beats 4.27 % of java submissions题目描述:The cou...原创 2018-07-11 21:33:04 · 149 阅读 · 0 评论 -
leetcode题记:Search Insert Position
编程语言:java提交结果:62 / 62 test cases passed.Status: AcceptedRuntime: 3 msps:运行时间和占用空间打败了100%的提交者,hhh题目描述: Given a sorted array and a target value, return the index if the target is found....原创 2018-07-08 15:45:13 · 190 阅读 · 0 评论 -
Best Time to Buy and Sell Stock
Best Time to Buy and Sell StockSay 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 (i.e., buy one ...原创 2018-10-09 23:04:59 · 375 阅读 · 0 评论