A9电面面经

原帖地址:一亩三分地

没有签什么NDA,网上也没看到多少A9面经,发一记分享给大家~

1. Given an array of integers and a number N, write a function to rotate the array to the right by N positions
For example
Given an array = [A,B,C,D,E,F,G,H] with N=3, the result will be [F,G,H,A,B,C,D,E]

follow up:protect your function against malicious inputs

2.Given 3 array of Strings.

Array one = {Red, Green, Blue}
Array two = {Large, Medium, Small}
Array three={giant, monster}

Print out combinations of all three array.

public void combination(String[][] arrays) {}

3.
Given an array of 1,000,000 integers where each integer is between 0 and 2^20 – 1
Find one integer that is between 0 and 2^20 -1 that is not in the array.
Hint: 2^20 = 1,048,576 > 1,000,000. That means there are at least 48,576 integers that are not in the array
要求 尽量优化时空复杂度

最近看到amazon在new york times的报道有点被吓到ヽ(′o`;
不过A9的职位好喜欢=)
希望能给onsite