# Copy Books

Given n books and the ith book has A[i] pages. You are given k people to copy the n books.n books list in a row and each person can claim a continous range of the n books. For example one copier can c......

# 经典二分法

Find any position of a target number in a sorted array. Return -1 if target does not exist.java实现public class Solution { /* * @param nums: An integer array sorted in ascending order * @p......

# 百度抽样算法面试题（部分）

1.　　给你一个长度为N的链表。N很大，但你不知道N有多大。你的任务是从这N个元素中随机取出k个元素。你只能遍历这个链表一次。你的算法必须保证取出的元素恰好有k个，且它们是完全随机的（出现概率均等）。解：先选中前k个， 从第k+1个元素到最后一个元素为止， 以k/i (i=k+1, k+2,...,N) 的概率选中第i个元素，并且随机替换掉一个原先选中的元素， 这样遍历一次得到k个元素， 可以保证......

# strStr II

Implement strStr function in O(n + m) time. strStr return the first index of the target string in a source string. The length of the target string is m and the length of the source string is n. If...

# Expression Expand

Given an expression s includes numbers, letters and brackets. Number represents the number of repetitions inside the brackets(can be a string or another expression)．Please expand expression to be a ...

# Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integers or other lists.  Notice You don't nee...

# Zigzag Iterator

Given two 1d vectors, implement an iterator to return their elements alternately. Have you met this question in a real interview?  Yes Example Given two 1d vectors: v1 = [1, 2] v2...

# High Five

There are two properties in the node student id and scores, to ensure that each student will have at least 5 points, find the average of 5 highest scores for each person. Have you met this ques...

# Top k Largest Numbers II

Implement a data structure, provide two interfaces: add(number). Add a new number in the data structure.topk(). Return the top k largest numbers in this data structure. k is given when we create ...

# Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Have you met this question in a real interview?  Yes Example Given lists: [ 2...

# Triangle Count

Given an array of integers, how many three numbers can be found in the array, so that we can build an triangle whose three edges length is the three numbers that we find?  Have you met this quest...

647条 共44页1 2 3 4 5 ... 下一页 尾页
个人资料
• 访问：197614次
• 积分：7981
• 等级：
• 排名：第3115名
• 原创：605篇
• 转载：37篇
• 译文：5篇
• 评论：56条
最新评论