leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1033.cpp (305B)


0 class Solution {
1 public:
2 vector<int> numMovesStones(int a, int b, int c) const {
3 if (a > b) swap(a, b);
4 if (a > c) swap(a, c);
5 if (b > c) swap(b, c);
7 if (a + 1 == b && b + 1 == c) return {0, 0};
8 return {b - a <= 2 || c - b <= 2 ? 1 : 2, c - a - 2};
9 }
10 };