leetcode们
文章平均质量分 59
姜枫渔火
这个作者很懒,什么都没留下…
展开
-
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, and you may not use the sam原创 2017-12-16 13:50:41 · 119 阅读 · 0 评论 -
70. Climbing Stairs
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 n will be a posi原创 2017-12-16 15:08:45 · 120 阅读 · 0 评论 -
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. /** * Definition for binary tree原创 2017-12-16 14:56:04 · 111 阅读 · 0 评论 -
111. Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 核心思想是树的递归遍历,同时注意斜树的存在。 class Soluti原创 2017-12-16 14:51:20 · 166 阅读 · 0 评论 -
21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Merge two sorted linked lists and return it as a new list原创 2017-12-16 14:31:31 · 126 阅读 · 0 评论 -
141. Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 用C++吧,python创建链表、树啥的总觉得不正规…… /** * Definition for singly-linked list. * struc原创 2017-12-16 14:21:59 · 99 阅读 · 0 评论 -
53. Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1]原创 2017-12-16 14:02:05 · 149 阅读 · 0 评论 -
63. Unique Paths II
Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in the原创 2017-12-16 13:55:52 · 147 阅读 · 0 评论 -
62. Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the原创 2017-12-16 13:53:15 · 131 阅读 · 0 评论 -
116. Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node.原创 2017-12-16 15:03:43 · 129 阅读 · 0 评论