Count Subarrays Whose Product Has an Odd Number of Divisors

Asked at Microsoft · Coding Questions · Difficulty: Hard · Last asked Nov 4, 2026

You are given an array of positive integers. For any contiguous subarray, multiply its elements together and count the positive divisors of the product. A subarray is called special when that count is odd. Count how many subarrays are special.

Loading the problem…