PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Capital One

Count Pairs of Cyclically Equivalent Integers

Last updated: Jul 22, 2026

Quick Overview

Count unordered index pairs whose non-negative integers have decimal strings equivalent under cyclic rotation. The algorithm challenge emphasizes a precise equivalence relation, duplicate occurrences, string-length and leading-zero semantics, scalability to 200,000 values, and pair counts beyond 32-bit range.

  • medium
  • Capital One
  • Coding & Algorithms
  • Software Engineer

Count Pairs of Cyclically Equivalent Integers

Company: Capital One

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

# Count Pairs of Cyclically Equivalent Integers Two non-negative integers are **cyclically equivalent** when their standard decimal strings have the same length and one string can be obtained by moving zero or more leading characters to the end of the other. Given a list `numbers`, count unordered index pairs `(i, j)` with `i < j` whose values are cyclically equivalent. Equal values count as cyclically equivalent, and duplicate occurrences are distinct list elements. ## Function Signature ```python def count_cyclic_pairs(numbers: list[int]) -> int: ... ``` ## Constraints - `0 <= len(numbers) <= 200_000` - `0 <= numbers[i] <= 1_000_000_000` - Standard decimal notation has no leading zero, except that zero is represented as `"0"`. - The answer may exceed 32-bit range. ## Examples ```text Input: numbers = [123, 312, 231, 45] Output: 3 ``` ```text Input: numbers = [10, 1, 10, 100] Output: 1 ``` ```text Input: numbers = [7, 7, 7] Output: 3 ```

Quick Answer: Count unordered index pairs whose non-negative integers have decimal strings equivalent under cyclic rotation. The algorithm challenge emphasizes a precise equivalence relation, duplicate occurrences, string-length and leading-zero semantics, scalability to 200,000 values, and pair counts beyond 32-bit range.

Related Interview Questions

  • Reorder a String by Alternating Its Left and Right Ends - Capital One (medium)
  • Arrange Match Results in Repeating Win-Draw-Loss Order - Capital One (medium)
  • Sort Every Concentric Matrix Border Clockwise - Capital One (medium)
  • Sort Matrix Diagonals By Their Values - Capital One (medium)
|Home/Coding & Algorithms/Capital One

Count Pairs of Cyclically Equivalent Integers

Capital One logo
Capital One
Jul 21, 2026, 12:00 AM
mediumSoftware EngineerTake-home ProjectCoding & Algorithms
0
0

Count Pairs of Cyclically Equivalent Integers

Two non-negative integers are cyclically equivalent when their standard decimal strings have the same length and one string can be obtained by moving zero or more leading characters to the end of the other.

Given a list numbers, count unordered index pairs (i, j) with i < j whose values are cyclically equivalent. Equal values count as cyclically equivalent, and duplicate occurrences are distinct list elements.

Function Signature

def count_cyclic_pairs(numbers: list[int]) -> int:
    ...

Constraints

  • 0 <= len(numbers) <= 200_000
  • 0 <= numbers[i] <= 1_000_000_000
  • Standard decimal notation has no leading zero, except that zero is represented as "0" .
  • The answer may exceed 32-bit range.

Examples

Input: numbers = [123, 312, 231, 45]
Output: 3
Input: numbers = [10, 1, 10, 100]
Output: 1
Input: numbers = [7, 7, 7]
Output: 3

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Capital One•More Software Engineer•Capital One Software Engineer•Capital One Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.