-
Notifications
You must be signed in to change notification settings - Fork 58
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 :)
char a[n]; | ||
int b[n]; |
There was a problem hiding this comment.
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
if(a[i]=='U'){ | ||
x++; | ||
b[i]=x; | ||
} | ||
else | ||
{ | ||
x--; | ||
b[i]=x; | ||
} | ||
} |
There was a problem hiding this comment.
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?
x=0; | ||
|
||
for(i=0;i<n;i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spacing
Hey! This is my solution in C programming, if you want to add then please do. This is very easy and understandable code.