Pergunta de entrevista da empresa Meta

given two sorted arrays, please merge them into a single array and still sorted. how to determine the size of array?

Respostas da entrevista

Sigiloso

28 de jan. de 2012

If is not hard, but be careful of the boundary condition. But I got stuck at how to determin the size of array? If using the pointer (*p )which pointing the head of the array as the input, how do we compute the size of the array?

Sigiloso

3 de abr. de 2012

To find the size of an array without passing it.. you can do it using templates in C++. template void p(int (&arr)[N]) { cout << N << endl; } int main() { int arr[10]; p(arr); }