Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > First Digit Equals Last > Editorial

First Digit Equals Last — Solution & Editorial

Back to the Problem

Group by digit length: for length < the bound's length, count freely (first digit 1-9, last equals it, middle arbitrary); for the bound's length, enumerate the constrained prefix. (A full digit DP carrying the first digit handles 1018.)

Complexity: O(range of digit lengths)