
leetcode
拾薪
这个作者很懒,什么都没留下…
展开
-
LeetCode 292. Nim Game
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the原创 2016-02-21 15:55:53 · 406 阅读 · 0 评论 -
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 implement it without using e原创 2016-02-23 22:54:14 · 375 阅读 · 0 评论 -
LeetCode 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原创 2016-02-23 23:43:31 · 462 阅读 · 0 评论 -
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. 这个就是递归,不想太多 /** * Definitio原创 2016-02-24 00:02:32 · 476 阅读 · 0 评论 -
LeetCode 226. Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 懒人就是交换递归 /** * Definition for a binary tree node. * stru原创 2016-02-24 00:25:52 · 450 阅读 · 0 评论