- 博客(16)
- 收藏
- 关注
原创 LeetCode 198. House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house
2018-01-13 23:41:13
274
原创 LeetCode 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
2018-01-13 23:25:35
329
原创 LeetCode 64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at
2018-01-13 23:13:20
287
原创 LeetCode 455. Assign Cookies
class Solution {public: int findContentChildren(vector& g, vector& s) { int count = 0; sort(g.begin(),g.end()); sort(s.begin(),s.end()); int j = 0 , i = 0;
2018-01-13 18:25:26
209
原创 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 as many transactions as you like (ie, buy on
2018-01-13 17:51:38
229
原创 LeetCode 199. Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree, 1
2018-01-13 17:25:58
257
原创 LeetCode 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.解法:利用递归/** * Definition for a
2018-01-13 16:55:04
248
原创 LeetCode 113. Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \
2018-01-13 16:06:05
216
原创 LeetCode 112. Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum
2018-01-13 15:25:39
320
原创 LeetCode 101. Symmetric Tree
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 / \ / \3 4 4 3
2018-01-13 14:30:25
380
原创 LeetCode 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]
2018-01-13 13:37:35
251
原创 LeetCode 215. Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5
2018-01-12 22:50:34
279
原创 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 and the majority element
2018-01-12 18:01:16
223
原创 LeetCode 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-09-13 12:21:18
321
原创 Unity3D 入门小技巧——鼠标拾取并移动物体
一、鼠标拾取物体的原理在Unity3D当中,想要在观察面(Aspect)中拾取物体(有碰撞属性)的方法一般如下:1、声明一个观察的摄像机、一个从摄像机原点出发的射线Ray以及一个用于检测碰撞的RaycastHit;2、将射线Ray定义为从摄像机原点出发并且指向当前鼠标所在的坐标(屏幕坐标);3、定义碰撞RaycastHit为射线Ray与有碰撞属性的物体的碰撞点。
2017-04-06 16:23:21
18889
7
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人