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

palindrome_ms #39

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

palindrome_ms #39

wants to merge 1 commit into from

Conversation

marshi23
Copy link

No description provided.


while current_index < my_phrase.length

if my_phrase[current_index] == " "

Choose a reason for hiding this comment

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

To account for:

  1. multiple, consecutive white spaces
  2. white spaces at both current_index as well as back_index
    Consider:
  • not having the back_index moving forward not as an elsif but a separate condition.
  • converting the white space checking into a loop instead of conditional statements.

end

if my_phrase[current_index] != my_phrase[back_index] &&
# my_phrase[current_index] != " " &&

Choose a reason for hiding this comment

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

I think the suggestions mentioned in the above comment would help address the issue you were seeing here.

@shrutivanw
Copy link

Your algorithm is on the right track. To get all the test cases passing i.e. making your algorithm complete, consider the suggestions added in the comments inline.

Also think about and add a comment to explain and share the time and space complexity of your algorithm.

Slack me if you have any questions or would like to sound board more ideas.

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