-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbiweekly-contest-80
More file actions
70 lines (46 loc) · 1.46 KB
/
biweekly-contest-80
File metadata and controls
70 lines (46 loc) · 1.46 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
biweekly-contest-80
class Solution {
public:
bool strongPasswordCheckerII(string p) {
if(size(p) < 8) return false;
bool low = false , upper = false ,digit = false ,special = false;
for(auto c : p){
if(c>='a' and c<='z') low = true;
else if(c>='A' and c <='Z') upper = true;
else if(isdigit(c)) digit = true;
else special = true;
}
//Check the 6th condition
for(int i=0;i+1<size(p);i++) if(p[i] == p[i+1]) return false;
if(low and upper and digit and special) return true;
return false;
}
};
class Solution {
public:
long long countSubarrays(vector<int>& nums, long long k) {
long long res=0,curr=0;
int i=0,j=0;
int n=nums.size();
for(j=0;j<n;j++)
{
curr+=nums[j];
while(curr*(j-i+1)>=k)
curr-=nums[i--];
res+=(j-i+1);
}
}
};
class Solution {
public:
vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {
sort(potions);
long long need=0;
ans list;
for(int spell:spells){
need=(sucess/spell);
int val=n- lb(portion.b,potion.end,need)
ans.push(val);
}
}
};