FastPrepMinimize the Sum with Ceiling Halves
Problems/Minimize the Sum with Ceiling Halves

Minimize the Sum with Ceiling Halves

Squarepoint Capital logoSquarepoint Capital● MediumNEW GRADOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The written approach repeatedly takes a maximum, replaces it with its ceiling half, and sums after exactly k operations. Its linked card describes a different task. This version follows the concrete heap approach and defines nonnegative inputs and bounds, for about a 75% match.

Perform exactly operations changes to the nonnegative integer array values. In one change, choose any element x and replace it with ceil(x / 2).

Return the smallest possible sum after all changes, as a signed 64-bit integer. The same position may be chosen more than once.

For this exercise, assume zero is allowed. Replacing 0 or 1 leaves it unchanged, so any remaining changes may be spent on those values without changing the result.

Function

minimumHalvedSum(values: int[], operations: int) → long

Examples

Example 1

values = [5,3]operations = 1return = 6

Replace 5 with 3. The array becomes [3,3], whose sum is 6.

Example 2

values = [5]operations = 2return = 2

The only value changes from 5 to 3, then to 2.

Example 3

values = [0,1]operations = 4return = 1

Both values are fixed points under ceiling halves. All four changes leave the sum at 1.

Constraints

  • 1 <= values.length <= 5000.
  • 0 <= values[i] <= 1000000000.
  • 0 <= operations <= 100000.

More Squarepoint Capital interview questions

  • Evaluating Circuit ExpressionsOA · Seen Jul 2026
  • Match an XOR-Adjusted SumOA · Seen Oct 2025
  • Maximize Palindromic WordsOA · Seen Oct 2025
  • Longest Increasing Subsequence from Two ArraysOA · Seen Oct 2025
  • Resolve Overlapping Price RangesOA · Seen Dec 2024
  • Empty ShelfOA · Seen Sep 2024
  • Suggested ProductsOA · Seen Sep 2024
  • Newton Square Root to a Guaranteed TolerancePHONE SCREEN · Seen Nov 2026
  • Probability of Consecutive HeadsPHONE SCREEN · Seen Nov 2026
  • Three Points in a Semicircle: Monte Carlo EstimatePHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Maximum ScoreNVIDIA · OANVIDIA interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • Effective ManagerGoldman Sachs · OAGoldman Sachs interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
  • Minimize Total Weight After HalvingAmazon · ONSITE INTERVIEW
  • Defer Expenses to Preserve BalanceDRW · PHONE SCREENDRW interview questions
  • Minimize Array Sum After K Halving OperationsDocuSign · PHONE SCREENDocuSign interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions

Interview reports that mention this question

  • Squarepoint Capital C++ and Python SWE Interviews: 7 Experiences

Squarepoint Capital interview experiences

  • Squarepoint Campus SDE Interviews: 7 Experiences (Part 2 of 2)
  • Squarepoint Capital New Grad SDE OA: 5 Experiences (Part 1 of 2)
All Squarepoint Capital interview questionsSee Squarepoint Capital hiring insights
Saved
class Solution {
    public long minimumHalvedSum(int[] values, int operations) {
        // write your code here
    }
}
Checking account…