FastPrepMinimum Vector Read and Rotate Uses
Problems/Minimum Vector Read and Rotate Uses

Minimum Vector Read and Rotate Uses

IMC Trading logoIMC Trading● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an IMC Trading new grad online assessment. The goal is the least total number of uses of two machines. It is about 99% the same as the complete photographed questions. We chose these things: rotations stay in place, reads do not change anything, each use costs the same, the indexed entry must be completed, the limits on the input, and an integer interface. We did not rebuild choices that were not visible.

An unknown vector has length indexed entries. You can use either of two machines:

  • The read machine reveals the current first entry.
  • The rotation machine shifts entries 2 through n one place left and moves the first entry to the last position.

Find the minimum total number of machine uses needed to read every original indexed entry. For this exercise, assume each use costs one operation, a read does not modify the vector, each rotation persists, and an entry must actually be read even if its value equals another entry or could be guessed.

For this exercise, assume length is the supplied positive integer and the result is an exact signed 64-bit integer. Complete minimumMachineUses(length).

Function

minimumMachineUses(length: long) → long

Examples

Example 1

length = 1return = 1

One front read reveals the only entry; no rotation is needed.

Example 2

length = 3return = 5

Read, rotate, read, rotate, read reveals all three indexed entries using five machine operations.

Example 3

length = 5return = 9

Five reads and four rotations are sufficient. A rotation after the final read would add an unnecessary operation.

Constraints

  • For this exercise, assume 1 <= length <= 1000000000000.
  • Only one-position left rotations and front reads are allowed.
  • Every use of either machine counts toward the objective.

More IMC Trading Online Assessment questions

  • Earliest Meeting Start on a 24-Hour ClockOA · Seen Nov 2026
  • Grid Paths with Override PassesOA · Seen Oct 2026
  • Weighted LFU CacheOA · Seen Sep 2026
  • Rock JumpingOA · Seen Aug 2026
  • Stack Batch RemovalOA · Seen Aug 2026
  • Chain of CommandOA · Seen Aug 2026
  • Choose ContainersOA · Seen Aug 2026
  • Sub-matrix SumsOA · Seen Jul 2026
  • Sub-matrix SumsOA · Seen Jul 2026
  • Can Every Package Fit in a BoxOA · Seen Jul 2026

Similar questions at other companies

  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions

Interview reports that mention this question

  • IMC Trading OA: What It Tests (2026)

IMC Trading interview experiences

  • IMC Trading SWE OA and Video: 18 Experiences (Part 3 of 3)
  • IMC Trading SWE OA Questions: 22 Experiences (Part 2 of 3)
  • IMC SWE New Grad OA and Interviews: 58 Experiences (Part 1 of 3)
All IMC Trading interview questionsSee IMC Trading hiring insights
Saved
class Solution {
    public long minimumMachineUses(long length) {
        // Write your solution here.
    }
}
Checking account…