-
Notifications
You must be signed in to change notification settings - Fork 160
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
[Java] Challenge 0 to 10 (Unreviewed) #379
base: master
Are you sure you want to change the base?
Conversation
if (openers.contains(c)) { | ||
stack.push(c); | ||
} | ||
if (closers.contains(c)) { |
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.
else if
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.
good catch thanks!
|
||
boolean[] b = new boolean[128]; | ||
for (int i = 0; i < s.length(); i++) { | ||
b[s.charAt(i)] = true; |
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.
Does this handle the same character being in an input string twice or more?
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.
Yes it does. eg. String s = "apple"; String t = "plepva";
output is v found at index: 4
the reason being every character, if found, is stored in its char value index in a boolean array. regardless of how many are present in the string, it will will see true
for that char and know that it was present in the original string.
Still figuring out the right way to branch etc. any feedback is welcome