#面试编程题#给定一个大整数N,有如下的初始有序序列位于[0, N - 1]之间(见图)。请设计一个数据结构保存这个初始序列,然后写一个函数,接受一个input参数x, 满足0 <= x <= N - 1。 1) 假如x在该结构中不存在,出错处理; 2) 假如x在该结构中存在,返回x之后第一个不存在的数,并把该数写入结构中。展开全文
#面试编程题#Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element. 这题比较经典,在自己没有实现前,别着急看答案和讨论 🔗 网页链接展开全文
#面试编程题#如果给你一个arraylist,里面装的都是time span,可以假设数据结构如下。class TimeSpan { Long startTime; Long endTime; }; ArrayList<TimeSpan>;假设这个List是按照startTime排好序的。现在我给你一个time,能否低于O(n)的方法找到所有startTime<=time<=endTime的span?展开全文
#面试编程题#Partition a set of numbers into two such that difference between their sum is minimum, and both sets have equal number or one more of elements. For example: {1, 4, 9, 16} is partitioned as {1,16} and {4,9} with diff =17-13=4.展开全文
#面试编程题#Queue with three stacks. Implement a queue with three stacks so that each queue operation takes a constant (worst-case) number of stack operations. (谢谢 @张成_ICT )展开全文
#面试编程题#There is an integer array d which does not contain more than two elements of the same value. How many distinct ascending triples (d < d < d, i < j < k) are present?展开全文