FastPrepPartition Into K-Size Consecutive Groups
Problems/Partition Into K-Size Consecutive Groups

Partition Into K-Size Consecutive Groups

Dream11 logoDream11● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names a known task. It does not say how repeated values work, what order to use, how to handle edge cases, or what the number limits are. We chose those. Our version is about 91% the same as the reported question.

Given an integer array nums and a positive integer k, determine whether every array element can be used exactly once to form groups of exactly k values.

Within each group, the values can be reordered as v, v + 1, ..., v + k - 1. Duplicate values are separate multiset elements. Return true if such a partition exists; otherwise return false.

Function

canPartitionConsecutive(nums: int[], k: int) → boolean

Examples

Example 1

nums = [1,2,3,6,2,3,4,7,8]k = 3return = true

The groups can be [1,2,3], [2,3,4], and [6,7,8].

Example 2

nums = [1,2,3,4,5]k = 4return = false

Five elements cannot be divided into groups of exactly four.

Constraints

  • 1 <= nums.length <= 10^5.
  • 1 <= k <= nums.length.
  • -10^9 <= nums[i] <= 10^9.

More Dream11 Onsite Interview questions

  • Minimum Index Distance Between Two ValuesONSITE INTERVIEW · Seen Feb 2026
  • Subset Sum to TargetONSITE INTERVIEW · Seen Feb 2026

Similar questions at other companies

  • Nickname-Constrained GroupingZoox · ONSITE INTERVIEW
  • Minimum Distinct Prefix CostChubb · OA
  • Minimum Distinct Prefix CostGoldman Sachs · OA
  • Rearrange Songs by AuthorZomato / Eternal · OA
  • Find the Original Array From a Doubled ArrayGoogle · PHONE SCREEN
  • Find Max Health SumAmazon · OA
  • Fair Capped Money DistributionGusto · PHONE SCREEN · ONSITE INTERVIEW
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEW
  • Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEW
See Dream11 hiring insights
Saved
class Solution {
    public boolean canPartitionConsecutive(int[] nums, int k) {
        // Return whether the full multiset can be partitioned.
    }
}
Checking account…