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

Counting divisible Substrings #489

Closed
1 task done
PrashantVIT1 opened this issue Mar 9, 2022 · 5 comments
Closed
1 task done

Counting divisible Substrings #489

PrashantVIT1 opened this issue Mar 9, 2022 · 5 comments
Assignees

Comments

@PrashantVIT1
Copy link
Contributor

PrashantVIT1 commented Mar 9, 2022

Description

|| 8th Mar 2022 || HackWithInfy || Infosys ||

You are given a string Str of length N. Each character of the string is a base 10 digit.

Your task is to find the total number of substrings of Str such that the number denoted by the string Str[i...j] is divisible by 6. Since that result can be a very large return it is modulo 10^9+7.

Notes:
* It is given that a number denoted by Str[i..j] can have leading Zeroes.

Input Format
The first line contains an integer, N, denoting the length of the given string.
The next line contains a string, Str, denoting the given string.

Constrains
1 <= N <= 10^5
1 <= len(Str) <= 10^5

Sample Input Sample Output Explanation
3
328
0 No substring is divisible by 6
3
318
2 "18","318" divisible by 6
4
6151
1 "6" divisible by 6

Domain

Competitive Programming

Type of Contribution

Addition

Code of Conduct

@github-actions
Copy link

github-actions bot commented Mar 9, 2022

Hello @PrashantVIT1, thanks for creating your first issue at LearnCPP, hope you followed the guidelines.

@PrashantVIT1
Copy link
Contributor Author

/assign

@github-actions
Copy link

This issue has been assigned to PrashantVIT1!
It will become unassigned if it is not closed within 12 days. A maintainer can also add the pinned label to prevent it from being unassigned.

@PrashantVIT1
Copy link
Contributor Author

I have created another issue that has not been merged yet

@github-actions
Copy link

The issue is already assigned!
Please find/create a new issue to contribute to.
You can safely disregard the failed workflow notification for this issue. ❌

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

No branches or pull requests

1 participant