登录
|
注册
公司
标签
文章
搜索
数据结构
热门公司
欢聚时代
腾讯
网易
奇虎360
热门职位
研发工程师
所有
有回答
没回答
新题目
有最佳答案
排序
热度
·
时间
·
经典指数
1
0
2152
对于斐波拉契经典问题,我们都非常熟悉,通过递推公式F(n) = F(n - 1) + F(n - 2),我们可以在线性时间内求出第n项F(n),现在考虑斐波拉契的加强版,我们要求的项数n的范围为int范围内的非负整数,请设计一个高效算法,计算第n项F(n)。第一个斐波拉契数为F(0) = 1。 给定一个非负整数,请返回斐波拉契数列的第n项,为了防止溢出,请将结果Mod 1000000007。 测试样例: 3 返回:2 ...
阅读题目
动态规划
递归
数据结构
面试题
经典指数
1
0
1979
现在我们要读入一串数,同时要求在读入每个数的时候算出它的秩,即在当前数组中小于等于它的数的个数(不包括它自身),请设计一个高效的数据结构和算法来实现这个功能。 给定一个int数组A,同时给定它的大小n,请返回一个int数组,元素为每次加入的数的秩。保证数组大小小于等于5000。 测试样例: [1,2,3,4,5,6,7],7 返回:[0,1,2,3,4,5,6] ...
阅读题目
查找
排序
数据结构
面试题
经典指数
1
0
1540
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top element). Now you are supposed to implement a stack with an extra operation: PeekMedian -- return the median value of all the elements in the stack. With N elements, the median value is defined to be the (N/2)-th smallest element if N is even, or ((N+1)/2)-th if N is odd. 输入描 ...
阅读题目
栈
数据结构
面试题
经典指数
1
0
1538
对于一个元素各不相同且按升序排列的有序序列,请编写一个算法,创建一棵高度最小的二叉查找树。 给定一个有序序列int[] vals,请返回创建的二叉查找树的高度。 ...
阅读题目
树
数据结构
面试题
经典指数
1
0
1510
Disjoint-set data structure In computing, a disjoint-set data structure, also called a union–find data structure or merge–find set, is a data structure that keeps track of a set of elements partitioned into a number of disjoint (nonoverlapping) subsets. It supports two useful operations: Find: Determine which subset a particular element is in. Find typically returns an item from this set that serves as its "representative"; by comparing the result of two Find operations, one can determine wh ...
阅读题目
网易
数据结构
问答题
经典指数
1
2
15
题目数
1
贡献者
14
答案数
扫描后移动端查看
我也分享一个题目
相关标签
树
排序
栈
查找
递归
动态规划
队列
链表
数组
字符串
同类标签
内容运营
用户运营
操作系统
C/C++
网络基础
C++工程师
编译和体系结构
数据库
编程基础
java
微信公众号
欢迎加入,一起群聊
×
登录
注册
找回密码
记住登录
登录
快速注册
直接第三方登录