Jobs
Interviews

Solve Count Factor Pairs using Python Language

Solve Count Factor Pairs using Python to enhance your skills with python coding practice , master coding concepts, and prepare for interviews with practical exercises and detailed solutions.

Count Factor Pairs

Difficulty : Easy

Categories :

  • Mathematics

Given an array of positive integers arr, find the count of factor pairs for each number. A factor pair of a number n is a pair (a,b) where a * b = n. Order matters in the pair, so (a,b) and (b,a) are considered different if a ≠ b.

Constraints:

  • 1 ≤ arr.length ≤ 10^4
  • 1 ≤ arr[i] ≤ 10^5
  • Return results in the same order as input array

Examples:

Input: arr = [12,8]
Output: [6,4]
Explanation: 
For 12, factor pairs are: (1,12), (12,1), (2,6), (6,2), (3,4), (4,3)
For 8, factor pairs are: (1,8), (8,1), (2,4), (4,2)
Input: arr = [16,7,9]
Output: [5,2,3]
Explanation:
For 16: (1,16), (16,1), (2,8), (8,2), (4,4)
For 7: (1,7), (7,1)
For 9: (1,9), (9,1), (3,3)

Coding works best on a laptop or desktop, with a keyboard and a wider editor. You can read the problem here and solve it there.

Problem Solving

Input

What You'll Find Here

Interactive Exercises Practice coding with problems designed for beginners and experts.

Step-by-Step Solutions Understand every step of the solution process.

Real-World Scenarios Apply your skills to real-world problems and boost your confidence.

Choose from the following categories