1
class Solution {
2
public:
3
int countPoints(string rings) {
4
int n = rings.length();
5
// It is given that number of rod is 10 0 to 9 so we have to place ring any
6
// of these
7
vector<int> vp(10, 0); // store the no of rings
8
for (int i = 0; i < n; i += 2) {
9
char col = rings[i];
10
vp[rings[i + 1] - '0'] |= (col == 'R' ? 1 : col == 'G' ? 2 : 4); // checking for rings
11
}
12
int count = 0;
13
for (int i = 0; i < 10; i++) {
14
if (vp[i] == 7) {
15
count++;
16
}
17
}
18
return count;
19
}
20
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0