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

Computing a raised to b mod c in logn time #108

Closed

Conversation

yashagarwal1999
Copy link

@yashagarwal1999 yashagarwal1999 commented Dec 12, 2019

Solved
close #101

@rishabhgarg25699
Copy link
Owner

@yashagarwal1999 Give proper indentation to the code

@yashagarwal1999
Copy link
Author

Added Indentation to the code

return r;
}


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space required.

Copy link
Owner

@rishabhgarg25699 rishabhgarg25699 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashagarwal1999 Please make correct indentation.

cin>>a>>b>>c;
ll ans=fast_power(a,b,c);
cout<<ans<<endl;
return 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space

ll fast_power(ll n, ll k, ll p = MOD) {
ll r = 1;
for (; k; k >>= 1)
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space

ll r = 1;
for (; k; k >>= 1)
{
if (k & 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 line space after bracket.

using namespace std;

ll fast_power(ll n, ll k, ll p = MOD) {
ll r = 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No indentation.

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

Successfully merging this pull request may close these issues.

Computing a raised to b mod c in logn time?
2 participants