FastPrepKnight Dialer Sequences
Problems/Knight Dialer Sequences

Knight Dialer Sequences

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in several firsthand Bloomberg new-grad interviews. The task is to count the digit sequences a knight can dial on a phone keypad. The answer is taken modulo 1,000,000,007.

A chess knight is dialing numbers on the standard telephone keypad:

1 2 3
4 5 6
7 8 9
  0

A sequence may start on any digit. Each following digit must be reachable from the previous digit by one legal knight move. Given the sequence length n, return the number of valid digit sequences modulo 1000000007.

Function

countKnightDialerNumbers(n: int) → int

Examples

Example 1

n = 1return = 10

Every one-digit sequence is valid.

Example 2

n = 2return = 20

There are twenty directed knight moves between keypad digits.

Example 3

n = 3return = 46

Extending every valid two-digit sequence by one knight move produces forty-six sequences.

Constraints

  • 1 <= n <= 5000.
  • A sequence may begin at any of the ten digits.
  • Digit 5 has no legal outgoing knight move.

More Bloomberg LP Phone Screen questions

  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Knight Dialer SequencesConfluent · ONSITE INTERVIEWConfluent interview questions
  • Count Routes Through Four Shop TypesOpenAI · OAOpenAI interview questions
  • All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Minimum Total Layover WaitGoogle · PHONE SCREENGoogle interview questions
  • Shortest Paths in a Nonnegative Directed GraphNation with NaMo · PHONE SCREEN
  • Count Staircases with Strictly Increasing StepseBay · ONSITE INTERVIEWeBay interview questions
  • Unique Grid PathsMorgan Stanley · PHONE SCREENMorgan Stanley interview questions
  • Minimum Traveling Salesperson TourGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • Minimum Completion Time for DAG DependenciesAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Work Order Critical PathHadrian · PHONE SCREENHadrian interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int countKnightDialerNumbers(int n) {
        // Write your code here.
    }
}
Checking account…