FastPrepCount Equal-Distinct Character Partitions
Problems/Count Equal-Distinct Character Partitions

Count Equal-Distinct Character Partitions

Infosys logoInfosys● HardNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Infosys new grad online assessment. The report gives the goal of splitting a string into parts with an equal count of distinct letters, and a limit on length. We completed the rest: a lowercase alphabet, parts that are not empty, a result modulo a number, and the method interface. Our version is about 91% the same as the reported question.

Partition a non-empty lowercase string into one or more non-empty contiguous parts. A partition is valid when every part contains the same number of distinct characters.

Return the number of valid partitions modulo 1,000,000,007.

Function

countEqualDistinctPartitions(value: String) → int

Examples

Example 1

value = "aaa"return = 4

Every cut pattern is valid because every non-empty part has one distinct character.

Example 2

value = "abca"return = 3

The valid partitions are the whole string, four single characters, and ab | ca.

Constraints

  • 1 <= value.length <= 100000
  • value contains only lowercase English letters.

Source note: Interview prompt excerpt preserved as source evidence.

More Infosys Online Assessment questions

  • At Most K Jumps with Quadratic Transition CostOA · Seen Nov 2026
  • Hiking Club Fastest PaceOA · Seen Nov 2026
  • Lowest Common Ancestor with a Changing RootOA · Seen Nov 2026
  • Minimum Leaf Path Sum over All RootsOA · Seen Nov 2026
  • Split Array to Minimize the Largest SumOA · Seen Nov 2026
  • Cherry PickupOA · Seen Nov 2026
  • Lexicographically Smallest Grid Path with One Letter ChangeOA · Seen Nov 2026
  • Minimum Cost to Supply Water with Wells and PipesOA · Seen Nov 2026
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3OA · Seen Nov 2026
  • Minimum Rounds to Complete All TasksOA · Seen Nov 2026

Similar questions at other companies

  • Max Subarray Filled With ZerosGoogle · OAGoogle interview questions
  • Long BreakWeRide · OAWeRide interview questions
  • New 21 Game ProbabilityUiPath · PHONE SCREEN
  • Maximum Earnings Across WarehousesAmazon · ONSITE INTERVIEW
  • API Shield with Two Rolling LimitsGraviton · OA
  • Expected Steps Until a Random Walk Gets Far From ZeroOptiver · OAOptiver interview questions
  • Largest Consistent Visiting GroupAuxoAI · OA
  • Delete K Subsets for Maximum ScoreRubrik · OARubrik interview questions
  • Safest Shortest Path Through a GridSnowflake · OASnowflake interview questions
  • Part 2: Batch Access ReviewScale AI · OAScale AI interview questions
All Infosys interview questionsSee Infosys hiring insights
Saved
class Solution {
    public int countEqualDistinctPartitions(String value) {
        // Write your code here.
    }

}
Checking account…