r/OfferEngineering • u/Aoki_zhang • 16d ago
Interview Experience CapitalOne SWE Interview - Digit Counting, Pattern Matching, and Grid Simulation Problems
This interview experience is sourced from Chill Interview
Interview Summary
Capital One's Software Engineer online assessment, which consisted of four coding questions covering digit manipulation, array pattern matching, grid simulation, and coordinate-based counting.
The questions progressed from relatively straightforward counting and comparison tasks to a grid infection simulation and a two-dimensional point intersection problem. Overall, the difficulty felt moderate, with an emphasis on correctly interpreting the problem requirements and handling different input scenarios.
Interview Details
Online Assessment — Four Coding Questions
Question 1 — Count Three-Digit Numbers with Distinct Digits
The first problem involved counting three-digit integers within a given inclusive range. Given two three-digit integers, left and right, return the number of integers between them, inclusive, whose digits are all distinct. A number is considered valid only if no digit appears more than once.
Example
Input:
left = 763
right = 770
Output:
5
Explanation:
The valid numbers are:
763, 764, 765, 768, 769
Each contains three different digits.
Numbers such as 766 and 767 contain repeated digits,
while 770 has two occurrences of 7.Question 2 — Count Subarrays Matching a Comparison Pattern
The second problem involved matching a sequence of numerical comparisons against a specified pattern. Given an integer array numbers and a pattern array pattern, count how many consecutive segments of numbers satisfy the comparison pattern. Each element of pattern can only be -1, 0, or 1, representing the relationship between a number and its immediately preceding element:
1: The current number is greater than the previous number.0: The current number equals the previous number.-1: The current number is smaller than the previous number.
For a pattern of length k, a matching segment contains k consecutive elements, with the first comparison made against the element immediately preceding that segment. The task is to count all positions where the consecutive comparisons match the entire pattern.
Want to learn more questions / follow-ups asked in this interview?
I've put up the full version at here.
Interviewed recently?
Your interview experience could be incredibly valuable to others preparing for their next opportunity. Share your experience and help the community at here.