Pergunta de entrevista da empresa Cloudera

I don't remember the exact question, but basic statement was: There is a door with equal horizontal and vertical bars number 1 to n. As an input there will be array V[] and H[] which had numbers representing V[i] bar missing from vertical and H[i] bar missing from horizontal where 0<=i<=n. You have to calculate is the largest gap in the matrix.

Resposta da entrevista

Sigiloso

22 de ago. de 2019

Sort V[] and H[] in descending order. Initialise V1[] with all o to n values and do similar H1[]. Iterate through V[] and replace the value of V1[V[i]] = V1[V[i]+1]. Similarly, do the same with H[] and H1[]. Now iterate through H1[] and v1[] finding largest difference between adjacent element and their product will be the answer