---
# System prepended metadata

title: Weekly Contest 360
tags: [Weekly Contest]

---

###### tags: `Weekly Contest`
# Weekly Contest 360

## [2833. Furthest Point From Origin]() (<font color=#00B8A3>Easy</font>)

限制 :
<ul>
<li><code>1 <= moves.length == n <= 50</code></li>
<li><code>moves consists only of characters 'L', 'R' and '_'</code></li>
</ul>

### Solution
就是簡單的計算哪邊數字大，相減之後再加上底線的數量即為答案。

#### 時間複雜度: $O(n)$

#### 空間複雜度: $O(1)$

程式碼:

```c++=
class Solution {
public:
    int furthestDistanceFromOrigin(string moves) {
        int num_R = 0, num_L = 0, num_S = 0;
        for(int i=0; i < moves.size();i++)
        {
            switch(moves[i])
            {
                case 'L':
                    num_L++;
                    break;
                case 'R':
                    num_R++;
                    break;
                case '_':
                    num_S++;
                    break;
            }
        }
        return max(num_R, num_L) + num_S - min(num_R, num_L);
    }
};
```

## [2834. Find the Minimum Possible Sum of a Beautiful Array](https://leetcode.com/problems/find-the-minimum-possible-sum-of-a-beautiful-array/) (<font color=#FFC011>Medium</font>)

限制 :

<ul>
<li><code>1 <= n <= 10<sup>9</sup></code></li>
<li><code>1 <= target <= 10<sup>9</sup></code></li>
</ul>
### Solution

#### 時間複雜度: $O()$

#### 空間複雜度: $O()$

程式碼:

```c++=
```

## [3]()(<font color=#FFC011>Medium</font>)

限制 :

<ul>
<li><code>10<sup>4</sup></code></li>
</ul>
### Solution

#### 時間複雜度: $O()$

#### 空間複雜度: $O()$

程式碼:

```c++=
```

## [4]()(<font color=#FF375F>Hard</font>)

限制 :

<ul>
<li><code>10<sup>4</sup></code></li>
</ul>
### Solution

#### 時間複雜度: $O()$

#### 空間複雜度: $O()$

程式碼:

```c++=
```
