NeetCode #113LC-1590MediumArrays & Hashing
← Back to All Problems#113 · #1590 · Make Sum Divisible by P(使数组和能被 P 整除)
📌 Problem Statement & Constraints
Given an array of positive integers
nums and an integer p, remove the shortest subarray (possibly empty) so that the sum of the remaining elements is divisible by p. Return the length of the shortest such subarray, or -1 if impossible. Constraints: 1 <= nums.length <= 10^5, 1 <= nums[i] <= 10^9, 1 <= p <= 10^9.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!