Skip to content

Counting Valley Hackerrank Problem #6

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Subhamchoudhary77
Copy link

Hey! This is my solution in C programming, if you want to add then please do. This is very easy and understandable code.

Copy link
Owner

@c650 c650 left a comment

Choose a reason for hiding this comment

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

I don't really take contribs on this repo but I gave you a review :)

Comment on lines +10 to +11
char a[n];
int b[n];
Copy link
Owner

Choose a reason for hiding this comment

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

variable length arrays are bad imo

Comment on lines +18 to +27
if(a[i]=='U'){
x++;
b[i]=x;
}
else
{
x--;
b[i]=x;
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

you do the same thing in both branches?

Comment on lines +29 to +31
x=0;

for(i=0;i<n;i++)
Copy link
Owner

Choose a reason for hiding this comment

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

nit: spacing

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.

2 participants