Ants, Dice and Bayes Theorem

Ants, Dice and Bayes Theorem

Today we are introducing a new series solving Data Science interview questions at these same companies. We will solve three simple problems asked at Facebook for a Data Science role.

We have so far solved a few algorithmic/coding problems asked in programming interviews across some of the best companies in the world. Today we are introducing a new series solving Data Science interview questions at these same companies. Many of these places do not have a specialized role for Data Scientists (although that’s changing rapidly). For the rest, a Data Scientist typically solves a logical/mathematical puzzle on a whiteboard. Few of these interviews also ask deep/technical questions on SQL. The rest of the interviews are almost identical to the algorithmic/coding interviews that we have seen so far in this blog. Today, we will solve three simple problems asked at Facebook for a Data Science role. Read along…

Problem 1:

Three ants are sitting at the corners of an equilateral triangle. Each ant randomly picks a direction and starts moving along the edge of the triangle. What is the probability that none of the ants collide? Now, what if it is k ants on all k corners of an equilateral polygon?

Solution

Let’s start simple, shall we? Here are two ways of solving this problem, both should be obvious after a little thought:

  1. How many ways can an ant (at any vertex) move? Precisely two!. All the movements of all three ants are independent are each other. As a result, the total number of movements for all three ants is equal to 2³= 8. How many of these movements result in no-collision? Again, precisely two! (1) All ants moving clockwise, and (2) all ants moving counter-clockwise. As a result, the probability of no collision is simply 2/8 = 0.25. How about k ants? There are again two ways a single ant can move, and hence, k ants can move in 2ᵏ different ways. Just like in the case of a triangle, there are precisely two movements resulting in non-collisions. Again, (1) All ants moving clockwise, and (2) all ants moving counter-clockwise. As a result, the probability of non-collision is simply 1/(2ᵏ-¹).
  2. The above method was frequency counting, where you count the number of ways the event of interest occurs, and divide it by the total number of ways. Let’s directly calculate the probability of non-collision by calculating the probabilities of two independent and mutually exclusive events.

facebook software-development data-science probability interview-que

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

50 Data Science Jobs That Opened Just Last Week

Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments. Our latest survey report suggests that as the overall Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments, data scientists and AI practitioners should be aware of the skills and tools that the broader community is working on. A good grip in these skills will further help data science enthusiasts to get the best jobs that various industries in their data science functions are offering.

5 Core Criteria for Selecting Software Development Company - TopDevelopers.co

Check out these five criteria for the selection of your software vendor, and you will never regret having the wrong quality product made for you.

Applications Of Data Science On 3D Imagery Data

The agenda of the talk included an introduction to 3D data, its applications and case studies, 3D data alignment and more.

Data Science Interviews: Probability and Statistics

Topics to study and 20 problems to look over