Count Product-Divisible Pairs
Updated
Problem statement
Given an integer array nums and a positive integer k, return the number of index pairs i < j such that nums[i] * nums[j] is divisible by k.
Function
countProductDivisiblePairs(nums: int[], k: int) → longExamples
Example 1
nums = [1,2,3,4,5]k = 2return = 7Example 2
nums = [1,2,3,4]k = 5return = 0Constraints
1 <= nums.length <= 100000.0 <= nums[i] <= 10^9.1 <= k <= 10^5.
More Motive Phone Screen questions
- Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Search in Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
- Pair Left and Right Shoes by SizePHONE SCREEN · Seen Jun 2025
- Lowest Common Ancestor in a Binary TreePHONE SCREEN · Seen Apr 2025
- Mark a Queen’s Attack BoardPHONE SCREEN · Seen Feb 2025
- Resolve Variable Equations with Dependency ErrorsPHONE SCREEN · Seen Jun 2024
- Average Values by Binary-Tree LevelPHONE SCREEN · Seen May 2024
- Chunked Round-Robin Row TraversalPHONE SCREEN · Seen May 2024
Similar questions at other companies
- Filter Paginated Medical RecordsNVIDIA · PHONE SCREENNVIDIA interview questions
- Pair Up an Array So Every Pair Sum Divides by kAdobe · PHONE SCREENAdobe interview questions
- Employee Count Median, Mean and ModeClay · PHONE SCREEN
- Max Points on a LineUber · PHONE SCREENUber interview questions
- Average Grades per StudentHartford Financial Services · PHONE SCREENHartford Financial Services interview questions
- Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
- Count Subarrays with a Perfect-Square ProductMicrosoft · OAMicrosoft interview questions
- Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
- Get Triplet CountIBM · OAIBM interview questions
- Group-Relative Policy AdvantagesAmazon · ONSITE INTERVIEW