注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
发一家法国公司的面经,面的是在湾区的分部,公司很多法国人,法式英语把我听醉了。
1。 电面, moving average。 直接上code吧- public class MovingAverage {
- // Please write a method to compute the moving average of an list of double values
- //
- // 1,2,3,4,5
- // 3
- // ans = 2,3,4
- // time : O(n)
- public List<Double> getMovingAverage(double[] arr, int k) {
- List<Double> res = new ArrayList<Double>();
- double sum = 0.0;
- Deque<Integer> dq = new LinkedList<Integer>();
- for (int i = 0; i < arr.length; i++) {
- sum += arr[i]; // 12
- dq.addLast(i);
- if (i >= k - 1) {
- res.add(sum / k); // 6 ans: 2 // 9: 3 // 12 : ans: 4
- int first = dq.pollFirst();
- sum -= arr[first]; // 5 // 7
- }
- }
- return res;
- }
- }
复制代码 onsite:
1. 没有code, 就code就行了
4. manager, 就是聊了聊, behavior question,
它家面试比较简单。位置在A9对面。
看了面经,请加分啊~
|