[JavaScript] 2833. Furthest Point From Origin
Weekly Contest 360\n- Q1 - below\n- Q2 - https://leetcode.com/problems/find-the-minimum-possible-sum-of-a-beautiful-array/solutions/3972757/javascript-2834-find
**Weekly Contest 360**\n- Q1 - below\n- Q2 - https://leetcode.com/problems/find-the-minimum-possible-sum-of-a-beautiful-array/solutions/3972757/javascript-2834-find-the-minimum-possible-sum-of-a-beautiful-array/\n\n---\n\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n\n1\n```\nvar furthestDistanceFromOrigin = function (a) {\n  let cc1 = 0\n  let cc2 = 0\n  for (let c of a) {\n    if (c === \'R\') cc1++\n    if (c === \'L\') cc1--\n    if (c === \'_\') cc2++\n  }\n  return Math.abs(cc1) + cc2\n};\n```\n\n2 - switch\n\n```\nvar furthestDistanceFromOrigin = function (a) {\n  let cc1 = 0\n  let cc2 = 0\n  for (let c of a) {\n    switch (c) {\n      case \'R\':\n        cc1++\n        break\n      case \'L\':\n        cc1--\n        break\n      case \'_\':\n        cc2++\n        break\n    }\n  }\n  return Math.abs(cc1) + cc2\n};\n```\n
['JavaScript']