代码改变世界

238_Product of Array Except Self

2015-12-23 13:14 by FTD_W, 148 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... 阅读全文

122_Best Time to Buy and Sell Stock II

2015-12-21 15:56 by FTD_W, 234 阅读, 0 推荐, 收藏, 编辑
摘要:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文

260_Single Number III

2015-12-17 09:42 by FTD_W, 446 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements t... 阅读全文

C# 比较时间问题

2015-12-11 14:38 by FTD_W, 231 阅读, 0 推荐, 收藏, 编辑
摘要:C#中 DateTime类型的变量格式是:2015/12/11 13:58:59如果只比较年月日而不比较时分秒,可以:nowTime = Convert.ToDateTime(nowTime.ToShortDateString());startTime = Convert.ToDateTime(st... 阅读全文

226_Invert Binary Tree

2015-12-06 10:33 by FTD_W, 176 阅读, 0 推荐, 收藏, 编辑
摘要:反转二叉树,将每个节点的左节点和右节点交换可以使用递归方法,先将交换函数在左节点和右节点递归下去,然后再交换左右节点C:/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct T... 阅读全文

100_Same Tree

2015-12-02 08:58 by FTD_W, 122 阅读, 0 推荐, 收藏, 编辑
摘要: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 an... 阅读全文

283_Move Zeroes

2015-12-01 16:27 by FTD_W, 143 阅读, 0 推荐, 收藏, 编辑
摘要:Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givenn... 阅读全文

237_Delete Node in a Linked List

2015-11-27 17:36 by FTD_W, 130 阅读, 0 推荐, 收藏, 编辑
摘要: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 is1 -> 2 -> 3 -> ... 阅读全文

104_Maximum Depth of Binary Tree

2015-11-27 17:03 by FTD_W, 112 阅读, 0 推荐, 收藏, 编辑
摘要: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 le... 阅读全文

136_Single Number

2015-11-26 15:19 by FTD_W, 157 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity... 阅读全文