Skip to content

Commit d652e75

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 6.4 MB (Top 13.82%)
1 parent ea9b1d7 commit d652e75

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 6.4 MB (Top 13.82%)
12
class Solution {
23
public:
3-
4+
45
vector<int> numMovesStones(int a, int b, int c) {
5-
6+
67
vector<int> arr = {a, b, c};
7-
8+
89
sort(arr.begin(), arr.end());
9-
10+
1011
// find minimum moves
11-
12+
1213
int mini = 0;
13-
14+
1415
if(arr[1] - arr[0] == 1 && arr[2] - arr[1] == 1)
1516
{
1617
mini = 0;
@@ -23,11 +24,11 @@ class Solution {
2324
{
2425
mini = 2;
2526
}
26-
27+
2728
// find maximum moves
28-
29+
2930
int maxi = (arr[1] - arr[0] - 1) + (arr[2] - arr[1] - 1);
30-
31+
3132
return {mini, maxi};
3233
}
33-
};
34+
};

0 commit comments

Comments
 (0)