Skip to content

Practice Furthest Point From Origin

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2833
LeetCode Problem

Furthest Point From Origin

Problem Statement

Start at 0 and process moves in order. L moves one unit left, R one unit right, and _ lets you choose either direction. Return the largest absolute final position obtainable after all moves.

Source: Furthest Point From Origin on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
moves = "L_RL__R"
Output
3

# Example 2

Input
moves = "_R__LL_"
Output
5

# Example 3

Input
moves = "_______"
Output
7

Constraints

1 <= moves.length == n <= 50
moves consists only of characters 'L', 'R' and '_'.

Related LeetCode Problems

Practice more problems similar to Furthest Point From Origin.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.