Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 870. Advantage Shuffle
Given two equal-length arrays, permute nums1 to maximize the number of positions where nums1[i] > nums2[i]. This is a greedy matching problem: sort nums1 and for each nums2 element assign the smallest nums1 that beats it (otherwise sacrifice the smallest remaining), which yields an optimal arrangement.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.