码迷,mamicode.com
首页 >  
搜索关键字:median of two sorted    ( 17004个结果
Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted fr...
分类:其他好文   时间:2014-08-24 11:37:02    阅读次数:194
算法之 有序链表和平衡二叉树
题目描述: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 给定一个有序的链表,要求构建一颗平衡二叉查找树。 解析:二叉查找树的中序遍历的结构就是一颗二叉查找树,要使得最终的二叉查找树的结构尽可能的平衡,也就是说只需要...
分类:其他好文   时间:2014-08-23 23:02:31    阅读次数:389
【Leet Code】Add Two Numbers
Add Two Numbers  Total Accepted: 20255 Total Submissions: 88115My Submissions You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order a...
分类:其他好文   时间:2014-08-23 21:40:01    阅读次数:200
Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4.....
分类:其他好文   时间:2014-08-23 21:37:41    阅读次数:199
UVA - 1069 Always an integer (模拟)
Description Combinatorics is a branch of mathematics chiefly concerned with counting discrete objects. For instance, how many ways can you pick two people out of a crowd of n people? Into how many...
分类:其他好文   时间:2014-08-23 20:24:01    阅读次数:317
[LeetCode] Divide Two Integers( bit + 二分法 )
Divide two integers without using multiplication, division and mod operator.常常出现大的负数,无法用abs()转换成正数的情况class Solution{private: vector f;public: in...
分类:其他好文   时间:2014-08-23 17:43:11    阅读次数:215
HDU 2492 pingpang
Problem Description N(3 Each player has a unique skill rank. To improve their skill rank, they often compete with each other. If two players want to compete, they must choose a referee among oth...
分类:其他好文   时间:2014-08-23 15:27:21    阅读次数:253
UVA - 10237 Bishops
A bishop is a piece used in thegame of chess which is played on a board of square grids. A bishop can only movediagonally from its current position and two bishops attack each other if oneis on the pa...
分类:其他好文   时间:2014-08-23 15:26:31    阅读次数:286
Remove Duplicates from Sorted Array
Remove Duplicates from Sorted Array  Total Accepted: 22879 Total Submissions: 70824My Submissions Given a sorted array, remove the duplicates in place such that each element appear only on...
分类:其他好文   时间:2014-08-23 15:25:01    阅读次数:196
hdu1102 Constructing Roads (简单最小生成树Prim算法)
Problem DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to e...
分类:其他好文   时间:2014-08-23 15:15:40    阅读次数:234
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!