Available question text
Given a positive integer n, repeatedly apply n/2 if n is even or either n+1 or n−1 if n is odd and return the minimum number of moves to reach 1. The core challenge is choosing the optimal increment vs decrement for odd n (often solved with bit-manipulation/greedy or BFS/DP), with inputs up to 2^31−1.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 397. Integer Replacement
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source