Multiples of 2 and 3 Problem Statement

Ninja is engaged in a task involving divisors. He is given 'N' numbers, and his objective is to compute the sum of all numbers which are divisible by either 2 or 3.

Example:

Input:
N = 5
Numbers = [1, 2, 3, 5, 6]
Output:
11
Explanation:

For the numbers provided (1, 2, 3, 5, 6), only 2, 3, and 6 are divisible by either 2 or 3. Hence, the sum is 2 + 3 + 6 = 11.

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 10^3
  • 0 <= input[i] <= 10^3
Be the first one to answer
Add answer anonymously...
Bank of America Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter