
LeetCode
swingspring
这个作者很懒,什么都没留下…
展开
-
[LeetCode] Delete 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 you are given the third node with value 3原创 2015-09-30 00:23:55 · 385 阅读 · 0 评论 -
[LeetCode] Same Tree
Given 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 value.递归算法 深度优先算法原创 2015-09-30 01:31:40 · 584 阅读 · 0 评论 -
[LeetCode] Move Zeroes
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 example, given nums = [0, 1, 0, 3, 12], after calling your原创 2015-09-30 11:09:16 · 342 阅读 · 0 评论 -
[LeetCode] 226 Invert a binary tree.
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this original tweet by原创 2015-09-30 12:14:47 · 348 阅读 · 0 评论 -
[LeetCode] 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.递推算法 4ms AC/** * Definition for a原创 2015-09-29 23:41:50 · 374 阅读 · 0 评论