-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBulbSwitcher3.cpp
More file actions
52 lines (48 loc) · 1.29 KB
/
BulbSwitcher3.cpp
File metadata and controls
52 lines (48 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
#include<vector>
using namespace std;
// todo: There is a room with n bulbs, numbered from 1 to n, arranged in a row
// from left to right. Initially, all the bulbs are turned off.
// At moment k (for k from 0 to n - 1), we turn on the light[k] bulb. A bulb
// changes color to blue only if it is on and all the previous bulbs (to the left)
// are turned on too.
// Return the number of moments in which all turned-on bulbs are blue.
// int numTimesAllBlue(vector<int>& light)
// {
// int n = light.size();
// vector<bool> v(n, 0);
// int ans=0;
// for(int i=0; i<n; i++)
// {
// vector<bool>::iterator it = v.begin();
// v[light[i]-1] = 1;
// bool val = 1;
// bool flag = 1;
// for(int j=0; j<n; j++)
// {
// if(v[j] == 0)
// {
// flag = 0;
// break;
// }
// it++;
// }
// if(find(it, v.end(), val) == v.end())
// {
// cout << light[i] << endl;
// ans++;
// }
// }
// return ans;
// }
int main()
{
vector<int> v = {2,1,3,5,4};
// cout << numTimesAllBlue(v);
cout << "lol" << endl;
for(int i=0; i<1000; i++)
{
cout << rand()%1000 << ",";
}
}
// LC: Q.1375