随笔分类 - 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
阅读全文
摘要:问题: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
阅读全文
摘要:题目:Given a binary tree, find its maximum depth. 计算二叉树的深度。 解决:采用深度优先遍历。
阅读全文
摘要:问题:Given an array of integers, every element appears twice except for one. Find that single one. 思考:运用双循环,微循环循环待比较数字,内层比较。增加一个flag表明是否匹配。 知识:flag的使用,以
阅读全文
摘要:问题: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
阅读全文
摘要:从今天开始,每天刷一道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
阅读全文

浙公网安备 33010602011771号