FastPrepMinimum Steps with Double and Floor-Divide
Problems/Minimum Steps with Double and Floor-Divide

Minimum Steps with Double and Floor-Divide

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report states the two allowed moves, the starting value 1, and the goal of using the fewest steps, from a Bloomberg campus technical interview. It says breadth-first search was the intended direction. We use floor division exactly as reported, and a small range of targets so a full breadth-first search runs in every language.

Given target, return the fewest steps needed to reach it, starting with the integer 1.

Each step replaces the current value x with either:

  • x * 2, or
  • floor(x / 3), which divides and rounds down to an integer.

Function

minStepsToTarget(target: int) → int

Examples

Example 1

target = 1return = 0

The starting value already equals the target.

Example 2

target = 5return = 5

One shortest sequence is 1 -> 2 -> 4 -> 8 -> 16 -> 5.

Example 3

target = 3return = 7

A shortest sequence is 1 -> 2 -> 4 -> 8 -> 16 -> 32 -> 10 -> 3.

Constraints

  • 0 <= target <= 100
  • All intermediate values are represented with signed 64-bit integers.
  • Every target in the allowed range is reachable.

More Bloomberg LP Onsite Interview questions

  • 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
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Count Reachable Values by Halving and DecrementingInfosys · OAInfosys interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Shortest Pin Path Through TopicsPinterest · PHONE SCREENPinterest interview questions
  • Integers With Multiple Sum of Two CubesCharta Health · PHONE SCREEN · ONSITE INTERVIEWCharta Health interview questions
  • Word Chain Jumps in a GridGoogle · PHONE SCREENGoogle interview questions
  • Currency Conversion RateAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Hierarchical Permission CheckeBay · ONSITE INTERVIEWeBay interview questions
  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREENWaymo interview questions
  • Group Identical Tree LevelsSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Filter Paginated Medical RecordsNVIDIA · PHONE SCREENNVIDIA 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 minStepsToTarget(int target) {
        // Write your code here.
    }

}
Checking account…