FastPrepSort Array by Increasing Frequency
Problems/Sort Array by Increasing Frequency

Sort Array by Increasing Frequency

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The Bloomberg new-grad report names this well-known problem directly. Our version is about 100% the same as the reported question.

Given an integer array nums, sort it by increasing value frequency. When two values have the same frequency, place the larger value first. Return the sorted array.

Function

frequencySort(nums: int[]) → int[]

Examples

Example 1

nums = [1,1,2,2,2,3]return = [3,1,1,2,2,2]

The value that appears once comes first, then the value that appears twice, then the value that appears three times.

Example 2

nums = [2,3,1,3,2]return = [1,3,3,2,2]

Two and three tie in frequency, so the larger value three comes first.

Constraints

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

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Config Store with Priority OverridesMicrosoft · PHONE SCREENMicrosoft interview questions
  • Majority ElementByteDance · PHONE SCREENByteDance interview questions
  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • Best Anagram MatchGoogle · PHONE SCREENGoogle interview questions
  • Values Exclusive to the Current UserMeta · PHONE SCREENMeta interview questions
  • Count Values Appearing Exactly OnceAgoda · PHONE SCREENAgoda interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int[] frequencySort(int[] nums) {
        // Write your code here.
    }

}
Checking account…