Validate ABA Routing Numbers Before Accepting an ACH Payee

Last updated: November 29, 2026

Quick Overview

Write a function that takes a string and returns whether it is a structurally valid 9-digit ABA routing number, using the 3-7-1 weighted checksum and the allowed Federal Reserve prefix ranges.

Wells Fargo
Coding & Algorithms
Software Engineer
Wells Fargo
November 29, 2026
Software Engineer
Online Assessment
Coding & Algorithms
Easy

0

0

0 solved


Write a function that takes a string and returns whether it is a structurally valid 9-digit ABA routing number, using the 3-7-1 weighted checksum and the allowed Federal Reserve prefix ranges.

Adding an external payee in Wells Fargo online banking or a commercial ACH file starts with cheap local validation before any network lookup. This style of warm-up checks that a candidate reads a spec carefully, handles bad input without crashing, and knows that a checksum only rules numbers out.

What the Interviewer Expects
  • Reject anything that is not exactly 9 ASCII digits, including spaces and dashes
  • Apply weights 3,7,1 repeating and require the sum to be divisible by 10
  • Check the first two digits against valid Federal Reserve ranges
  • Explain that passing the checksum does not prove the bank exists
  • Keep it O(1) and side-effect free
Key Topics to Cover
Checksums
Input validation
String handling
Payments data quality
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you also confirm the routing number belongs to an active institution?
  • Users paste numbers with spaces or dashes. Where should normalization happen?
  • How would you test this function exhaustively for single-digit typos?
  • Does the checksum catch every adjacent transposition? Why or why not?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input is a raw string. Output is a boolean. Valid means: exactly 9 digits, weighted checksum 3d1+7d2+d3+3d4+7d5+d6+3d7+7d8+d9≡0(mod10)3d_1+7d_2+d_3+3d_4+7d_5+d_6+3d_7+7d_8+d_9 \equiv 0 \pmod{10}, and the first two digits fall in 00-12 (sta...

High-Level Design

Do the cheap structural check first (length and digits), then the checksum, then the prefix. Each step can return early. This is a pure function, which makes it trivial to unit test and safe to run on...


Submit Your Answer
Markdown supported

Related Questions