FastPrepSum Skipping Multiples of 7
Problems/Sum Skipping Multiples of 7

Sum Skipping Multiples of 7

Bank of America logoBank of America● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bank of America new grad recorded video interview that also had coding tasks. The task was to add up the numbers from 1 to n but leave out every multiple of 7.

The report gives no limit on n and no examples. Here, n can be as large as one billion, so the answer needs a 64-bit integer.

Our version is about 90% the same as the reported question.

Given a positive integer n, return the sum of all integers from 1 to n, skipping every number that is a multiple of 7.

Both 1 and n are part of the range.

Function

sumSkippingMultiplesOfSeven(n: int) → long

Examples

Example 1

n = 10return = 48

The numbers from 1 to 10 add up to 55. The only multiple of 7 in that range is 7, so the answer is 55 - 7 = 48.

Example 2

n = 6return = 21

No number from 1 to 6 is a multiple of 7, so all of them are added: 1 + 2 + 3 + 4 + 5 + 6 = 21.

Example 3

n = 14return = 84

The numbers from 1 to 14 add up to 105. Skipping 7 and 14 removes 21, so the answer is 105 - 21 = 84.

Constraints

  • 1 <= n <= 10^9

More Bank of America Online Assessment questions

  • Return Exact Cash Register ChangeOA · Seen Aug 2026
  • Wildcard Substring MatchOA · Seen Nov 2025
  • Maximum String BeautyOA · Seen Sep 2024
  • Merge Point of Two Linked ListsOA · Seen Oct 2023
  • Remove Duplicates from a ListOA · Seen Oct 2023
  • Pairs with Target Sum in a Sorted ArrayOA · Seen Oct 2023
  • Count Level-Order Traversals of a TreeOA · Seen Sep 2023
  • Count Set BitsOA · Seen Sep 2023
  • Count Pairs with Sum KOA · Seen Jun 2023
  • Letter Pattern SumOA · Seen Sep 2022

Similar questions at other companies

  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions

Bank of America interview experiences

  • Bank of America interviews · December 2025
  • Bank of America OA · December 2025
  • Bank of America interviews · September 2026
  • Bank of America OA · September 2026
All Bank of America interview questionsSee Bank of America hiring insights
Saved
class Solution {
    public long sumSkippingMultiplesOfSeven(int n) {
        // write your code here
    }
}
Checking account…