码迷,mamicode.com
首页 >  
搜索关键字:find    ( 24186个结果
Lowest Common Ancestor of a Binary Tree解析
Lowest Common Ancestor of a Binary Tree Total Accepted: 6162 Total Submissions: 23311 My Submissions Question Solution Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in...
分类:其他好文   时间:2015-07-26 19:23:17    阅读次数:192
[leedcode 136] Single Number
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:其他好文   时间:2015-07-26 19:03:17    阅读次数:103
Is It A Tree?----poj1308
http://poj.org/problem?id=1308#include#include#include#include#include#define N 110#define INF 0xfffffffusing namespace std;int f[N],vis[N];int Find(i...
分类:其他好文   时间:2015-07-26 17:05:43    阅读次数:110
[LeetCode][Java] Best Time to Buy and Sell Stock IV
题目: Say 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 complete at most k transactions. Note: Y...
分类:编程语言   时间:2015-07-26 15:56:12    阅读次数:142
[LeetCOde][Java] Best Time to Buy and Sell Stock III
题目: Say 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 complete at most two transactions. Note: ...
分类:编程语言   时间:2015-07-26 15:53:12    阅读次数:155
[LeetCode] Kth Smallest Element in a BST
Kth Smallest Element in a BST Given a binary search tree, write a function kthSmallestto find the kth smallest element in it. Note:  You may assume k is always valid, 1 ≤ k ≤ BST's total elem...
分类:其他好文   时间:2015-07-26 15:52:22    阅读次数:125
#leetcode#Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the tota...
分类:其他好文   时间:2015-07-26 15:50:28    阅读次数:113
leetcode:Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a...
分类:其他好文   时间:2015-07-26 15:30:45    阅读次数:98
1059. Prime Factors (25)
题目如下: Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km. Input Specification: Each input file contai...
分类:其他好文   时间:2015-07-26 14:18:45    阅读次数:124
hdu 1247 Hat’s Words(从给的单词中找hat's word 并按字典序输出)
1.在使用mp[key]的时候它会去找键值为key的项,如果没有,他会自动添加一个key的项,再把value赋值为相应的初始值(value是int的话赋值为0,string的话赋值为空)。所以如果是插入的话可以用insert,如果是查找的话可以使用find,这样可以节省开销。查找的时间复杂度为O(logn) 2. 代码:#include #include #include using ...
分类:其他好文   时间:2015-07-26 12:49:38    阅读次数:160
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!