Category: Array coding problemA remote system uses a circular array of backup generators to sustain a critical task. Each generator can power the system for a fixed number of...Input: Array Output: Integer
codingHardVerified Question#2
2. [CodeSignal] Grid Arithmetic Path
Category: Matrix coding problemYou are given a grid where each cell contains either a single digit ('0' to '9') or an arithmetic operator ('+' or '-'). Starting from any cell, you...Input: Matrix (2D array) Output: Integer
codingEasyVerified Question#3
3. [CodeSignal] Cyclic Consonant Shift
Category: String coding problemYou are given a string s consisting of lowercase English letters. Transform each character using the following rules: - If the character is a vowel...Input: String Output: Computed result
codingMediumVerified Question#4
4. [CodeSignal] Leftmost Zero Filler
Category: Array coding problemYou are given a binary array slots containing only 0s and 1s, and an array of string commands ops. Apply each command in order: - Command "1": Find...Input: Array of strings Output: Computed result
codingMediumVerified Question#5
5. [CodeSignal] Matrix Command Engine
Category: Matrix coding problemYou are given a 2D integer array grid of size n x m and an array of strings commands. Apply each command in order: - "reverseRow r": Reverse the...Input: Matrix (2D array) Output: Computed result
codingMediumVerified Question#6
6. [CodeSignal] Sequential House Builder
Category: Grid/matrix coding problemYou are monitoring cell activations on an infinite integer grid line. Initially, no cells are active. You are given an array queries of distinct...Input: 2D grid Output: Integer
codingEasyVerified Question#7
7. [CodeSignal] Vowel Enclosed Reversal
Category: Array coding problemYou are given an array of strings text. For each word that starts and ends with a vowel (case-insensitive: a, e, i, o, u), reverse the substring...Input: Array of strings Output: Computed result
codingHardVerified Question#8
8. Text Layout Formatter
Category: Graph coding problemYou are formatting a document page. Given paragraphs (a 2D array of words), aligns (alignment per paragraph), and width (maximum characters per...Input: Graph (nodes and edges) Output: Computed result
codingHardVerified Question#9
9. [CodeSignal] Round-Robin Package Dispatcher
Category: Trie-based coding problemA logistics platform assigns packages to processing stations in round-robin order. You are given stationCapacity (max packages each station can...Input: Given input Output: Integer
codingMediumhash map#1
1. [Hash Map] — Validate Credit Card Number
Background: Credit card validation is crucial in financial services to ensure that the provided card numbers are legitimate before processing transactions. Capital One handles numerous transactions daily, making this task essential for fraud prevention and customer security. Problem statement: Implement a function that checks if a given credit card number is valid based on the Luhn algorithm. The function should take a string that may contain spaces and return a boolean indicating whether the number is valid. Use only the digits in the number for the validation process. Input: String card_number. Function signature: def validate_credit_card(card_number: str) -> bool: Example 1: Input: "4539 1488 0343 6467" Output: True Explanation: The card number passes the Luhn algorithm check. Example 2: Input: "1234 5678 9012 3456" Output: False Explanation: The card number fails the Luhn algorithm check. Constraints:
The input string will not be empty.
The string may contain digits and spaces only.
The length of the number (not including spaces) will be between 12 and 19 digits.
codingMediumgraph#2
2. Graph — Find the Shortest Path in a Financial Network
Background: Capital One requires efficient algorithms to process transactions through various financial instruments and routes. The system models a network of transactions representing paths between accounts, and optimizing these paths can lead to significant cost savings. Problem statement: You need to implement a function that finds the shortest path between two nodes, representing account balances, in a directed graph where each edge represents a transaction cost. Given an array of edges, where each edge consists of two nodes and a cost, implement a function that returns the minimum cost to transfer from a source node to a target node. If it is impossible to reach the target from the source, return -1. Function signatures:
Explanation: The only path is 0 to 1 to 2 with costs 10 + 1 = 11.
Constraints:
1 <= edges.length <= 1000
0 <= src, target <= 1000
1 <= cost <= 1000
Every pair of nodes has at most one edge between them.
codingMediumgraph#3
3. Graph — Count Numbers With Odd Zeros
Background: In order to understand user interactions with Capital One's digital products, we need to analyze data points stored in a numerical format. This helps in identifying patterns that can improve user experience. Problem statement: Given an integer n, implement a function to count how many integers from 1 to n have an odd number of zeros in their decimal representation. Example: For n = 20, the numbers with odd zeros are 10, 20. Function signature:def count_odd_zero_numbers(n: int) -> int: Example 1:
Input: 20
Output: 2
Explanation: The two integers 10 and 20 each have exactly one zero, which is odd.
Example 2:
Input: 100
Output: 10
Explanation: The ten integers are 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 which each have one zero.
Constraints:
1 <= n <= 10^5
codingMediumhash map#4
4. CODING — Counting Odd Zeros
Background: At Capital One, analyzing transaction data for anomalies is crucial for detecting fraud and ensuring the security of user accounts. Understanding numerical patterns helps in building reliable models for analytics frameworks. Problem statement: Given an integer array nums, detect and count numbers that contain at least one 0 in their decimal representation but have an odd number of these 0s. Return the count of such numbers. Function/class signature:
def count_odd_zeroes(nums: List[int]) -> int:
Example 1:
Input:nums = [101, 20300, 404, 500501, 70003]
Output:3
Explanation: The numbers 101, 20300, and 404 have odd counts of 0s (1, 3, and 1 respectively).
Example 2:
Input:nums = [123, 456, 789]
Output:0
Explanation: None of these numbers contain any 0s.
Constraints:
1 <= len(nums) <= 10000
-10^9 <= nums[i] <= 10^9
Consider the absolute values for counting 0s.
codingMediumtwo pointers#5
5. [Two Pointers] — Count Numbers with Odd Zeros
Background: As a financial institution, Capital One needs to analyze various numerical data for reporting and processing transactions. Identifying characteristics of numbers is essential to enhancing data integrity and validation checks. Problem statement: Given an array of integers, return the count of numbers that contain an odd number of zeros in their decimal representation. For example, the number '1001' has two zeros, while '100' has one zero. You must implement this in a performant manner. Function/class signature:
def count_odd_zeros(arr: List[int]) -> int:
Example 1: Input: [101, 100, 100000, 12345] Output: 2 Explanation: Only 101 and 100000 have an odd count of zeros.Example 2: Input: [500, 0, 20002, 1001] Output: 2 Explanation: 20002 and 1001 have an odd count of zeros.Constraints:
The length of arr is between 1 and 10^5.
Each integer in arr is between 0 and 10^9.
codingMediumgraph#6
6. [Graph] — Find the Shortest Path in a Network
Background: Capital One deals with a variety of financial products that require efficient routing of transactions across a network. Analyzing paths in a network can optimize transaction processing times and resource allocation. Problem statement: Given an undirected graph represented by an adjacency list, you need to determine the shortest path from a source node to a target node. If there is no possible path, return -1. Nodes are represented by integers. Use a breadth-first search (BFS) to explore the paths. Function/class signature:
Explanation: The shortest path is 0 -> 1 -> 2 -> 3, which consists of 3 edges.
Constraints:
The number of nodes in graph is between 1 and 1000.
The connections between nodes are limited to maximum 3 out of 4 possible links per node.
codingMediumdynamic programming#7
7. [Dynamic Programming] — Counting Numbers with Odd Zeros
Background: Capital One deals with numerous financial transactions and data, where identifying specific number characteristics can aid in fraud detection algorithms and analytics. Problem statement: Given a list of integers, nums, write a function that returns the count of numbers in the list that have an odd number of zeros in their decimal representation. You need to implement a function that iterates through each number, counts the number of zeros, and checks if this count is odd. Function/class signature:
def count_odd_zeroes(nums: List[int]) -> int:
Example 1:
Input: nums = [101, 300, 500, 200002]
Output: 2
Explanation: The first number 101 has 1 zero (odd), 300 has 1 zero (odd), 500 has 1 zero (odd), and 200002 has 3 zeroes (odd) - Total is 4 odd counts.
Example 2:
Input: nums = [40, 5, 700, 2222]
Output: 2
Explanation: 40 has 1 zero (odd), 5 has 0 zeros (even), 700 has 2 zeros (even), 2222 has 0 zeros (even) - Total is 1 odd count.
Constraints:
List length 1 <= nums.length <= 10^4
Each number 0 <= nums[i] <= 10^6
Start practicing Capital One questions
Sign up for free to access walkthroughs, AI-generated questions, and more.