leetcode
Code_J_xer
CS
展开
-
Leetcode 100 : same Tree
Leetcode—100same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same valu原创 2016-07-18 23:37:55 · 339 阅读 · 0 评论 -
Leetcode 319 : Bulb Switcher
Leetcode–319Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on原创 2016-07-18 08:45:52 · 353 阅读 · 0 评论 -
Leetcode 292 :Nim Game
Leetcode—292Nim 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原创 2016-07-18 09:54:03 · 546 阅读 · 0 评论 -
Leetcode 283
Leetcode—283Given 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 example, given nums = [0, 1, 0, 3, 12], after callin原创 2016-07-18 10:06:04 · 418 阅读 · 0 评论 -
Leetcode 258:Add Digits
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 o原创 2016-07-18 17:34:37 · 381 阅读 · 0 评论 -
Leetcode 238:Product of Array Except Self
Leetcode—238Product of Array Except SelfGiven an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Sol原创 2016-07-18 18:58:14 · 314 阅读 · 0 评论 -
Leetcode 237:Delete Node in a Linked List
Leetcode—237Delete Node in a Linked List Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and y原创 2016-07-18 19:10:12 · 398 阅读 · 0 评论 -
Leetcode 226:Invert a binary tree
Leetcode—226Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1【题目大意】:反转二叉树 第一次在知乎看到这个题目背后的故事的时候觉得蛮惊奇的 【解法】:简单的二叉树遍历,后续遍历 【AC代码】原创 2016-07-18 19:40:38 · 304 阅读 · 0 评论