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

[Java] Challenge 0 to 10 (Unreviewed) #379

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jdfurlan
Copy link
Contributor

Still figuring out the right way to branch etc. any feedback is welcome

@erocs erocs changed the title [Java] Challenge 10 [Java] Challenge 0 to 10 (Unreviewed) Jan 12, 2017
if (openers.contains(c)) {
stack.push(c);
}
if (closers.contains(c)) {

Choose a reason for hiding this comment

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

else if

Copy link
Contributor Author

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;

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?

Copy link
Contributor Author

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.

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