Statistics

Generate 7 integers with equal probability from a function which returns 1/0 with probability p and (1-p)

Data Scientist

Microsoft

Careem

Databricks

Adobe

Cloudera

Autodesk

Did you come across this question in an interview?

  • Generate 7 integers with equal probability from a function which returns 1/0 with probability p and (1-p)
  • Can you create a method to produce seven integers with equal likelihood using a binary function with probabilities p and 1-p?
  • What approach would you take to generate seven numbers with equal probability from a binary function?
  • How can you derive seven equally likely integers from a function that returns binary outcomes with certain probabilities?
  • Using a binary function with probabilities p and (1-p), how could you generate seven numbers with uniform probability?
  • If you have a function that outputs 1 or 0 with given probabilities, how would you generate seven equal-probability integers?
  • Could you design a scheme to produce seven integers of equal probability from a biased binary function?
  • What algorithm might you use to generate seven integers with equal probability from a function that outputs 1 or 0 with known probabilities?
  • How can you manipulate a binary function with specific probabilities to yield seven integers with equal chances?
  • Can you devise a way to obtain seven integers with uniform probability from a function that has a probability p of returning 1?
  • How would you use a binary function to generate seven equally probable integers?

Interview question asked to Data Scientists interviewing at Adobe, Coursera, Hopper and others: Generate 7 integers with equal probability from a function which returns 1/0 with probability p and (1-p).