随笔分类 -  LeetCode

Learning on the LeetCode
摘要:问题: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two eleme 阅读全文
posted @ 2016-04-21 11:28 wwwglin 阅读(190) 评论(0) 推荐(0)
摘要:问题:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. 思考:开始想通过两层for 阅读全文
posted @ 2016-04-14 15:48 wwwglin 阅读(175) 评论(0) 推荐(0)
摘要:题目:Given a binary tree, find its maximum depth. 计算二叉树的深度。 解决:采用深度优先遍历。 阅读全文
posted @ 2016-04-13 15:14 wwwglin 阅读(119) 评论(0) 推荐(0)
摘要:问题:Given an array of integers, every element appears twice except for one. Find that single one. 思考:运用双循环,微循环循环待比较数字,内层比较。增加一个flag表明是否匹配。 知识:flag的使用,以 阅读全文
posted @ 2016-04-12 14:12 wwwglin 阅读(164) 评论(0) 推荐(0)
摘要:问题: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 s 阅读全文
posted @ 2016-04-11 18:07 wwwglin 阅读(157) 评论(0) 推荐(0)
摘要:从今天开始,每天刷一道leetcode。 今天的题目很简单:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in the 阅读全文
posted @ 2016-04-11 17:46 wwwglin 阅读(298) 评论(0) 推荐(0)