Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1375. Number of Times Binary String Is Prefix-Aligned #8

Open
Arya-Gupta opened this issue Apr 14, 2022 · 1 comment
Open

1375. Number of Times Binary String Is Prefix-Aligned #8

Arya-Gupta opened this issue Apr 14, 2022 · 1 comment
Labels
pending Question pending to be solved

Comments

@Arya-Gupta
Copy link
Owner

https://leetcode.com/problems/number-of-times-binary-string-is-prefix-aligned/

@Arya-Gupta Arya-Gupta added the pending Question pending to be solved label Apr 14, 2022
@Thanh-Van-2001
Copy link

class Solution {
public:
int numTimesAllBlue(vector < int > & flips) {
int now = 0; // E flips i Wallegff
int exp = 1;
int res = 0;
for(int i = 0;i < flips.size();i++){
now += flips[i];
if(now == exp){
res++;
}
exp += i + 2;
}
return res;
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending Question pending to be solved
Projects
None yet
Development

No branches or pull requests

2 participants