New
The Learning module is now live
See what's new
×
Question Bank
Learning
NEW
Pricing
Blog
Forum
HOT
JobRadar
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Coding Question
AI Insights
Quick Summary
Find the split index that maximizes the sum of distinct elements in the left and right subarrays.
Both resulting subarrays must be non-empty.
Requires an efficient method to update distinct counts as the split point shifts across the array.
What This Tests
Dynamic tracking of set and frequency counts
Array partitioning and single-pass iteration
Hash table operations for distinct counting
Optimizing naive O(N^2) approaches to O(N) time
Common Patterns
Hashing
Two Pointers
Prefix/Suffix Aggregation
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Accepted
24
/40
Acceptance Rate
60.0%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
arr =
Output
Expected