Welcome to MindCipher, a social repository of the world's greatest brain teasers, logic puzzles and mental challenges.

Karthik Naidu

Likes 0

Karthik Naidu must be new here...

Ratings 1

3
2.0
Products Algorithm

Comments 2

Clock Works - Google Interview Question

If its quarter past 3 then minute hand is pointing at 3 but hour hand has slightly moved forward .hour hand grazes 30 degrees for every 1 hr(60 min) . so hour hand moves 7.5 degree for every 15 min.hence angle between hour and minute hand is 7.5 - 0=7.5 degrees.

context
Products Algorithm

Algorithm-> 1)find the product of all elements in the array .-O(n). 2)Run a loop through all elements and divide the product with that number and store in another array. -------------->Complexity = O(n+n)=O(2n)=>O(n). int i,j,prod=1; for(i=0;i<N;i++) { prod*=A[i]; //O(n) } for(i=0;i<N;i++) { O[i]=prod/A[i]; //O(n) }

context