摘要:
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文
摘要:
问题: 蓄水池抽样问题是,从一个长度为n的流中随机选取k个元素,使得n个元素中的每个元素都以相同的概率被采样到,通常情况下n是一个未知的很大的数目,而且无法将其载入主存中。 算法的正确性证明 定理:该算法保证每个元素以 k / n 的概率被选入蓄水池数组。 证明:首先,对于任意的 i,第 i 个元素 阅读全文
摘要:
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
摘要:
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
摘要:
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文