2017年8月29日

LeetCode: 258 Add Digits(easy)

摘要: 题目: 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 l 阅读全文

posted @ 2017-08-29 17:47 玲珑子 阅读(86) 评论(0) 推荐(0) 编辑

LeetCode: 448 Find All Numbers Disappeared in an Array(easy)

摘要: 题目: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, 阅读全文

posted @ 2017-08-29 17:12 玲珑子 阅读(113) 评论(0) 推荐(0) 编辑

2017年8月28日

LeetCode: 226 Invert Binary Tree(easy)

摘要: 题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 代码: Invert a binary tree. 自己的(递归实现): 别人的: 自己的(使用队列,非递归实现): 非递归和递归的在Le 阅读全文

posted @ 2017-08-28 20:04 玲珑子 阅读(77) 评论(0) 推荐(0) 编辑

LeetCode: 520 Detect Capital(easy)

摘要: 题目: Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when on 阅读全文

posted @ 2017-08-28 16:26 玲珑子 阅读(98) 评论(0) 推荐(0) 编辑

LeetCode:104 Maximum Depth of Binary Tree(easy)

摘要: 题目: 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 farthe 阅读全文

posted @ 2017-08-28 10:11 玲珑子 阅读(93) 评论(0) 推荐(0) 编辑

LeetCode: 485 Max Consecutive Ones(easy)

摘要: 题目: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The len 阅读全文

posted @ 2017-08-28 09:38 玲珑子 阅读(129) 评论(0) 推荐(0) 编辑

2017年8月26日

LeetCode: 136 Single Number(easy)

摘要: 题目: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime com 阅读全文

posted @ 2017-08-26 11:36 玲珑子 阅读(133) 评论(0) 推荐(0) 编辑

LeetCode: 292 Nim Game(easy)

摘要: 题目: 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 阅读全文

posted @ 2017-08-26 10:52 玲珑子 阅读(89) 评论(0) 推荐(0) 编辑

LeetCode: 521 Longest Uncommon Subsequence I(easy)

摘要: 题目: anysubsequence of the other strings. A subsequence is a sequence that can be derived from one sequence by deleting some characters without changin 阅读全文

posted @ 2017-08-26 09:32 玲珑子 阅读(118) 评论(0) 推荐(0) 编辑

2017年8月24日

LeetCode: 637 Average of Levels in Binary Tree

摘要: 题目: Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 阅读全文

posted @ 2017-08-24 22:38 玲珑子 阅读(116) 评论(0) 推荐(0) 编辑

导航