DSAMaster Logo
DSAMaster
BackeasyArrays

Find the Average Presence

Problem Description

Given an array of integers, calculate the average of all elements. Determine if that average value exists within the original array. Note: For this problem, if the average is not an integer, it is considered not present in the array.

Example 1
Input
[1, 2, 3, 4, 5]
Output
true

Explanation: The sum is 1+2+3+4+5 = 15. The average is 15/5 = 3. 3 is present in the array.

Example 2
Input
[10, 20]
Output
false

Explanation: The sum is 10+20 = 30. The average is 30/2 = 15. 15 is not present in the array.

Constraints

  • Array length will be between 1 and 1000.
  • Elements will be integers between -1000 and 1000.
00:00
Loading...

Sign in to Solve

Access the full code editor, ThinkBuddy AI hints, and track your progress.

Sign in Free
Test Cases & Output
Enter test input here...
Click "Run Code" to execute