Lowest Common Ancestor of a Binary Search Tree
摘要:题目:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedi...
阅读全文
posted @
2015-11-05 09:04
已停更
阅读(189)
推荐(0)
Excel Sheet Column Number
摘要:题目:Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: ...
阅读全文
posted @
2015-11-04 20:50
已停更
阅读(218)
推荐(0)
Product of Array Except Self
摘要:题目:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].S...
阅读全文
posted @
2015-11-04 14:34
已停更
阅读(185)
推荐(0)
Contains Duplicate
摘要:题目:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the ...
阅读全文
posted @
2015-11-04 09:52
已停更
阅读(191)
推荐(0)
Single Number III
摘要:题目:Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two element...
阅读全文
posted @
2015-11-03 15:07
已停更
阅读(175)
推荐(0)
Best Time to Buy and Sell Stock IV
摘要:题目: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 complet...
阅读全文
posted @
2015-11-03 13:55
已停更
阅读(155)
推荐(0)
Best Time to Buy and Sell Stock III
摘要:题目: ay you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may com
阅读全文
posted @
2015-11-03 13:54
已停更
阅读(172)
推荐(0)
Best Time to Buy and Sell Stock II
摘要:题目: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 complet...
阅读全文
posted @
2015-11-03 13:39
已停更
阅读(149)
推荐(0)
Best Time to Buy and Sell Stock
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction ...
阅读全文
posted @
2015-11-03 08:42
已停更
阅读(198)
推荐(0)
Invert Binary Tree
摘要:题目:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1解析: 1 /** 2 * Definition for a bina...
阅读全文
posted @
2015-11-02 21:09
已停更
阅读(211)
推荐(0)
Move Zeroes
摘要:题目: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, giv...
阅读全文
posted @
2015-11-02 14:37
已停更
阅读(214)
推荐(0)
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...
阅读全文
posted @
2015-11-02 11:12
已停更
阅读(254)
推荐(0)
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 is1 -> 2 -> 3 ...
阅读全文
posted @
2015-11-02 09:36
已停更
阅读(208)
推荐(0)
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...
阅读全文
posted @
2015-11-02 09:17
已停更
阅读(162)
推荐(0)
Single Number
摘要:题目:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complex...
阅读全文
posted @
2015-11-02 08:41
已停更
阅读(177)
推荐(0)
Add Digits
摘要:题目:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3...
阅读全文
posted @
2015-10-31 21:53
已停更
阅读(179)
推荐(0)
Nim 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 s...
阅读全文
posted @
2015-10-30 15:57
已停更
阅读(157)
推荐(0)
写在前面
摘要:今天开始刷LeeCode,开此随笔以备总结,2015.10.30,做题顺序以通过率正序排序
阅读全文
posted @
2015-10-30 14:50
已停更
阅读(151)
推荐(0)