Skip to main content

Uber

Uber OA-3 2023

Problem Description

Earth is now home to sentient creatures from thousands of different planets. As part of a committee maintaining the records of these visitors, you are tasked with answering queries about the guests.

One evening, you receive a query from the Daily Newspaper, which is writing an article on "The Average Alien." You are asked to answer the following:

Does an alien with the average number of legs for an alien residing on Earth actually exist on Earth?

The "number of legs" is represented by an array arr, where each entry corresponds to the number of legs each alien has. You must determine whether the rounded average number of legs exists in the array.

Input Format:

  • A list of integers arr where each integer represents the number of legs each alien has.

Output Format:

  • A string "True" if the rounded average number of legs is present in the list.
  • A string "False" if the rounded average number of legs is not present in the list.

Constraints:

  • The size of the array is less than 10^3.
  • 0 <= arr[i] <= 10^7 for each entry arr[i] in the array.

Sample Testcase:

Input:

[2, 3, 4]

Output:

True

Explanation:

  • The average number of legs is (2 + 3 + 4) / 3 = 3.
  • The average is rounded to 3, which is present in the array.