# 2833. Furthest Point From Origin

## Problem Statement

<br>

You are given a string `moves` of length `n` consisting only of characters `'L'`, `'R'`, and `'_'`. The string represents your movement on a number line starting from the origin `0`.

In the `ith` move, you can choose one of the following directions:

* move to the left if `moves[i] = 'L'` or `moves[i] = '_'`
* move to the right if `moves[i] = 'R'` or `moves[i] = '_'`

Return *the **distance from the origin** of the **furthest** point you can get to after* `n` *moves*.

&#x20;

**Example 1:**

<pre><code><strong>Input: moves = "L_RL__R"
</strong><strong>Output: 3
</strong><strong>Explanation: The furthest point we can reach from the origin 0 is point -3 through the following sequence of moves "LLRLLLR".
</strong></code></pre>

**Example 2:**

<pre><code><strong>Input: moves = "_R__LL_"
</strong><strong>Output: 5
</strong><strong>Explanation: The furthest point we can reach from the origin 0 is point -5 through the following sequence of moves "LRLLLLL".
</strong></code></pre>

**Example 3:**

<pre><code><strong>Input: moves = "_______"
</strong><strong>Output: 7
</strong><strong>Explanation: The furthest point we can reach from the origin 0 is point 7 through the following sequence of moves "RRRRRRR".
</strong></code></pre>

&#x20;

**Constraints:**

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

## Intuition

```
Approach:

LLLR____

3 -> L ; and 1 R
3-1 = 2 Hence we get 2 on left so fill all the _ with L
Thats the logic


```

### Links

<https://leetcode.com/problems/furthest-point-from-origin/description/>

### Video Links

### Approach 1:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
class Solution {
public:
    int furthestDistanceFromOrigin(string moves) {
        unordered_map<char, int> count;
        for(auto c: moves) 
            count[c]++;

        return max(count['L'],count['R']) - min(count['L'], count['R']) + count['_'];
    }   
};
```

{% endcode %}

### Approach 2:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
```

{% endcode %}

### Approach 3:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
```

{% endcode %}

### Approach 4:

```
```

{% code title="C++" lineNumbers="true" %}

```cpp
```

{% endcode %}

### Similar Problems

###
