Pergunta de entrevista da empresa Freshworks

2a) Given an array of numbers , make another array such that element at new array is product of all the other elements except that element in older array,and 3ants puzzle and balance brackets question and open ended question.

Respostas da entrevista

Sigiloso

23 de ago. de 2016

I said in O(n) and he wanted to solve in DP, which i don't know.

Sigiloso

21 de nov. de 2016

Array Question: Find the product of all elements(prod) in the array. In a for loop, new_array[i]=prod/original_array[i]; Balance brackets to be solved using stack: Push when you encounter an open bracket and pop when you encounter close bracket. 3 ants puzzle: 2 directions for each ant and 3 ants are there. Therefore 2^3=8 combinations. Only when all ants move along same direction(either forward or backward) they DON'T collide. Therefore probability is 6/8.