FastPrepPartition Into Groups of Five Consecutive Values
Problems/Partition Into Groups of Five Consecutive Values

Partition Into Groups of Five Consecutive Values

Google logoGoogle● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks whether an array can be grouped into sets of five consecutive values. We set that each occurrence is used once and that order inside a group does not matter. Our version is about 87% the same as the reported question.

You are given an integer array nums. Can you split all of its values into groups of exactly five, where each group's values can be put in the order x, x + 1, x + 2, x + 3, x + 4? Return true if you can, and false otherwise.

Every value in the array must go into exactly one group. If a value appears more than once, each copy counts as a separate value. An empty array counts as split into zero groups.

Function

canPartitionIntoFiveConsecutiveGroups(nums: int[]) → boolean

Examples

Example 1

nums = [1,2,3,4,5,2,3,4,5,6]return = true

The values split into [1,2,3,4,5] and [2,3,4,5,6]. Each group is five values in a row, so the answer is true.

Example 2

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

There are six values, and six values cannot be split into groups of five. So the answer is false.

Example 3

nums = []return = true

The array is empty, so zero groups already use every value. The answer is true.

Constraints

  • 0 <= nums.length <= 200000.
  • -10^9 <= nums[i] <= 10^9.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Minimum Distinct Prefix CostChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • Nickname-Constrained GroupingZoox · ONSITE INTERVIEW
  • Partition Into K-Size Consecutive GroupsDream11 · ONSITE INTERVIEWDream11 interview questions
  • Find Max Health SumAmazon · OA
  • Fair Capped Money DistributionGusto · PHONE SCREEN · ONSITE INTERVIEWGusto interview questions
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public boolean canPartitionIntoFiveConsecutiveGroups(int[] nums) {
        // Write your code here.
    }
}
Checking account…