Frequently Asked Puzzles in Job Interviews INTRODUCTION SANGHAMESH S VASTRAD

Overview Explanation of logic and code snippets, if necessary Each chapter will be of a particular puzzle Total of 6-7 chapters Pre-requisites : None

The 3 ants Problem

Problem statement 3 ants sitting on three There are corners of a triangle. All ants randomly pick a direction and start moving along edge of the triangle. What is the probability that any two ants don't collide?

Logic Every ant has two choices Hence, total number of possibilities = 2^3 8

Solution All ants move in clockwise or anti-clockwise direction

Answer Therefore, probability they won't collide = 2/8 or Variation Circle or any other shape with only 3 ants

Generalization What if the number of ants is n on a n-sided polygon? Always only 2 solutions possible, i.e, clockwise or anti-clockwise

Generalized solution Probability of not colliding-2/2 Please provide your feedback and rate this course Up Next: 5 Horses Puzzle

7 lessons,

1h 6m

Enroll

302

✕Download

Sanghamesh S Vastrad

Developer at Western Digital | CS graduate from SJCE, Mysore | GRE: 323/340 (Q:170)

U

Unacademy user

PR

Paras Rathi

a year ago

Very good sur than you you saveme

0

Reply

Abhilash C R

a month ago

what of square has diagonal?

0

Reply

Kiran Kumar G S

2 months ago

Good explanation, Thank you

1

Reply

Ruhi

2 months ago

how topossible become 8?

0

Reply

Sri Harsha

8 months ago

Dude don't talk like ur in a horny mood it's disguisting to listen to this although your info is excellent

0

Reply

Uday kumar

a year ago

if every ant has 2 directions soo we have only 6 possibilities noo

0

Reply