Dsa
Dynamic Programming
Warm-up
Minimum Steps to Reach Target
You are given a starting point at `0` on a number line and a target position `target`. You can move either one step to the left or one step to the right at a time. Find the minimum number of moves required to reach the target position.
Input format:
- A single integer, `target` (|target| <= 100).
Output format:
- A single integer, the minimum number of steps required to reach the target position.
Example:
Input:
4
Output:
4
Key concepts
dynamic_programmingstate_spaceminimum_path
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now