TypeScript solution (beats 100%)
IntuitionWe can calculate a number of left and right moves, then check abs difference value and append _ moves.ApproachIterating through all moves and calculati
# Intuition

We can calculate a number of left and right moves, then check abs difference value and append \_ moves.

# Approach

Iterating through all moves and calculating count of left, right and any moves.
Then use Math.abs to find absolute difference between left and right moves and append any to the value.

# Complexity

- Time complexity: O(n)



# Code
```typescript []
enum Moves {
  Left = 'L',
  Right = 'R',
  Any = '_'
}
function furthestDistanceFromOrigin(moves: string): number {
  let leftMovesCount = 0;
  let rightMovesCount = 0;
  let anyMovesCount = 0;

  for (const move of moves) {
    switch (move) {
      case Moves.Left:
        leftMovesCount++;
        break;
      case Moves.Right:
        rightMovesCount++;
        break;

      default:
        anyMovesCount++;
    }
  }

  return Math.abs(leftMovesCount - rightMovesCount) + anyMovesCount;
}


```
['TypeScript']