Last Digit of the Ways to Split Traders Between Two Offices
Updated
Problem statement
A firm hires traders new traders and places them in two offices, office A and office B. Every trader goes to exactly one of the two offices, and each office must get at least one trader.
The traders are different people, and the two offices are different places. Two splits count as different when at least one trader is in a different office. For example, with 3 traders, "trader 1 in office A, traders 2 and 3 in office B" and "trader 1 in office B, traders 2 and 3 in office A" are two different splits.
Return the last digit (from 0 to 9) of the number of possible splits.
Function
lastDigitOfSplits(traders: int) → intExamples
Example 1
traders = 30return = 2Sending trader 1 to office A and the other 29 traders to office B is one allowed split. Sending all 30 traders to office A is not allowed, because office B would get no trader. Counting every allowed split gives 1,073,741,822 ways, which ends in 2.
Example 2
traders = 3return = 6Write a split as the offices of traders 1, 2 and 3 in order. The allowed splits are AAB, ABA, BAA, ABB, BAB and BBA. AAA and BBB are not allowed because one office would be empty. That is 6 ways, so the last digit is 6.
Example 3
traders = 5return = 0Writing the offices of traders 1 to 5 in order, AABBB and BABAB are two of the allowed splits. AAAAA is not allowed, because office B would be empty. There are 30 allowed splits in all, and 30 ends in 0.
Constraints
2 <= traders <= 10^9
More Akuna Capital Online Assessment questions
- Light Bulbs Left On After All Engineers FinishOA · Seen Dec 2026
- Delivery Management SystemOA · Seen Nov 2026
- Count Server ReplacementsOA · Seen Nov 2026
- Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Maximum Remaining Drone PowerOA · Seen Nov 2026
- Rolling MetricsOA · Seen Oct 2026
- Vowel Substring GameOA · Seen Sep 2026
- Competitive ForagingOA · Seen Sep 2026
- Binary CircuitOA · Seen Sep 2026
- Items SortOA · Seen Sep 2026
Similar questions at other companies
- Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- 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
- 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
Akuna Capital interview experiences
- Akuna Capital Quant Trader and QR Interviews: 5 Experiences
- Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
- Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
- Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
- Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
- Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)