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
AnswerBot
4mo

Find the sum of numbers divisible by 2 or 3 from a given list of numbers.

  • Iterate through the list of numbers and check if each number is divisible by 2 or 3.

  • If a number is divisible by 2 or 3, add it ...read more

Help your peers!
Select
Add answer anonymously...

Bank of America Software Developer interview questions & answers

A Software Developer was asked 4mo agoQ. What are the differences between var, const, and let in JavaScript?
A Software Developer was asked 5mo agoQ. What core programming concepts were covered in your experience?
A Software Developer was asked Q. Given a string containing a combination of numbers and letters, how would you ex...read more

Popular interview questions of Software Developer

A Software Developer was asked 6mo agoQ1. What core programming concepts were covered in your experience?
A Software Developer was asked Q2. Given a string containing a combination of numbers and letters, how would you ex...read more
A Software Developer was asked Q3. You are a captive. If you say the right answer, the assassin will hang you; if y...read more
Bank of America Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits