Skip to main content
  1. Tags/

面试题

2017

阿里面试算法题(转载)

·9433 words·19 mins
I want to match those five numbers 3, 7, 8, 9, 87 through regular express. Here is my thought: match those four numbers 3 7 8 9 var ^[3|7|8|9]\( match number 87 var ^87\) Then combine them together, (^[3|7|8|9]\(|^87\)). With some test, it seems correct. Is there any way to do that more efficiently?

求旋转数组最小值(二分)

·183 words·1 min
题意:把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素。 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。

用两个栈实现队列

·198 words·1 min
思路: 一个元素入队的时候直接插入到stack1中。。。 一个元素出队的时候。。。如果stack2不为空。。stack2顶的元素就是要出队的。。