Count Multiples of Three with Two Sevens
Updated
Problem statement
You are given an integer array numbers.
Count how many values satisfy both of these conditions:
- The value is divisible by
3. - Its ordinary base-10 representation contains the digit
7at least twice.
Return that count.
Function
countDoubleSevenMultiples(numbers: int[]) → intExamples
Example 1
numbers = [77,177,707,777,27,3]return = 2177 and 777 are divisible by 3 and contain at least two sevens. The other values fail one or both conditions.
Example 2
numbers = [7,72,717,1770,7770]return = 3The qualifying values are 717, 1770, and 7770.
Example 3
numbers = [111,222,333]return = 0Every value is divisible by 3, but none contains the digit 7.
Constraints
1 <= numbers.length <= 10^5.1 <= numbers[i] <= 10^9.
More Hudson River Trading Online Assessment questions
- Count Palindrome Addition ChoicesOA · Seen Nov 2026
- Recursively Expanded Shell Command CountsOA · Seen Oct 2026
- Rotate Matrix Regions Around the DiagonalsOA · Seen Oct 2026
- Maximum Diamond SumOA · Seen Oct 2026
- Smallest Most-Lit Street PositionOA · Seen Oct 2026
- Rearrange String by Alternating EndsOA · Seen Sep 2026
- Most Items Within Budget from a Start IndexOA · Seen Sep 2026
- Count Fancy NumbersOA · Seen Sep 2026
- Count Pieces After Othello MovesOA · Seen Sep 2026
- Merge Row Trees by Key PathOA · Seen Sep 2026
Similar questions at other companies
- Closest ColorTwo Sigma · OATwo Sigma interview questions
- Price Deviation AlertsJane Street · OAJane Street interview questions
- Maximum Equal Parts for PrefixesAmazon · OA
- Most Cost-Effective MachineCapital One · ONSITE INTERVIEWCapital One interview questions
- Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
- Eight-Direction Keyboard Typing TimeBenchling · PHONE SCREENBenchling interview questions
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Count Valid Square PairsAuxoAI · OA
- Picked Player Who LostSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions