Minimum Operations with Multiply by Two and Divide by Three
Updated
Problem statement
Start at integer 1. Operation * replaces x with 2x; operation / replaces x with floor(x/3). Every intermediate state must remain between 1 and maxState.
Return a shortest operation string reaching target. Break shortest ties lexicographically with * before /. Return IMPOSSIBLE when unreachable.
Function
shortestOperationSequence(target: int, maxState: int) → StringExamples
Example 1
target = 10maxState = 16return = "****/*"1->2->4->8->16->5->10.
Example 2
target = 3maxState = 16return = "****/*/"One shortest path reaches 3 through 16, 5, 10, 3.
Constraints
1 <= target <= maxState <= 10^6.
More Bloomberg LP Onsite Interview questions
- 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
- Word SearchOA · PHONE 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
- Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Minimum Numeric Code TransformationAdobe · OAAdobe interview questions
- Unit Conversion Across Independent FamiliesApple · PHONE SCREENApple interview questions
- Frog Position After T SecondsInMobi · PHONE SCREENInMobi interview questions
- Reaching Points with Perfect-Square ObstaclesIMC Trading · OAIMC Trading interview questions
- Fewest Buses with the Full RouteMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Fuel Route with Fewest Station VisitsGoogle · ONSITE INTERVIEWGoogle interview questions
- Minimum Bus Routes to a DestinationPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
- Jump Game IVZomato / Eternal · ONSITE INTERVIEWZomato / Eternal interview questions
- Largest Island After One FlipOracle · ONSITE INTERVIEWOracle interview questions
- Grid Robot Route with Charging PrioritiesUber · PHONE SCREEN · ONSITE INTERVIEWUber 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)