FastPrepMinimum Magic Stones After Merges
Problems/Minimum Magic Stones After Merges

Minimum Magic Stones After Merges

ElevenLabs logoElevenLabs● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the rule for merging stones of the same level into the next level, the goal, the limits on levels, and a worked example. We chose the function signature.

Each magic stone has a positive integer level. At any time, two stones of the same level may merge into one stone whose level is one greater.

Return the minimum possible number of stones after performing any number of merges.

Function

minimumMagicStones(levels: int[]) → int

Examples

Example 1

levels = [1,2,1]return = 1

The two level-1 stones merge into level 2, then the two level-2 stones merge into one level-3 stone.

Example 2

levels = [4,4,4]return = 2

Two stones merge into level 5 and one level-4 stone remains.

Constraints

  • 1 <= levels.length <= 10^5.
  • 1 <= levels[i] < 10^4.
  • Merged levels may exceed the largest input level.

More ElevenLabs interview questions

  • Lowest-Cost Shirt Color ScheduleOA · Seen Oct 2026
  • Next Number with Disjoint DigitsOA · Seen Oct 2026
  • Longest Spoken PrefixONSITE INTERVIEW · Seen Nov 2026
  • Dubbing Review Status PropagationONSITE INTERVIEW · Seen May 2025

Similar questions at other companies

  • Build the Task HierarchyPendo · OA
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Items SortAkuna Capital · OAAkuna Capital interview questions
  • Count Cross-Array Target-Sum PairsVisa · OAVisa interview questions
  • Array Rank TransformTata Consultancy Services · OATata Consultancy Services interview questions
  • Find Max Health SumAmazon · OA
  • Influencers SquadTikTok · OATikTok interview questions
  • Count Teams Outscoring a Target TeamBloomberg LP · OABloomberg LP interview questions
  • Count Soldiers with a Next-Rank SuperiorMarshall Wace · OAMarshall Wace interview questions
All ElevenLabs interview questionsSee ElevenLabs hiring insights
Saved
class Solution {
    public int minimumMagicStones(int[] levels) {
        // Write your code here.
    }
}
Checking account…