Pergunta de entrevista da empresa Google

Onsite: Coding: 1)Print Matrix spiral order(top-down - bottom-up pattern) 2)Recommendation system for movies System Design: 1) Google Flight 2)tiny URL

Respostas da entrevista

Sigiloso

16 de set. de 2017

For the telephonic interview (pairs sum <= target) what solution did you gave? because anything less than n^2 is difficult to achieve

Sigiloso

5 de dez. de 2017

I'm not OP, but this is what I came up with: public static List findPairs(int n){ List results = new ArrayList(); for(int i = 1; i <= n/2; i++){ for(int j=1; j <= n-i; j++){ int[] pair = new int[2]; pair[0] = i; pair[1] = j; results.add(pair); } } return results; }