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

Added solution to Q44 #38

Merged
merged 1 commit into from
Oct 3, 2022
Merged

Conversation

rakshitgondwal
Copy link
Contributor

This is a template on how to fill out a PR properly.

Description

  • Maintain a boolean flag vector of s size+1. Need the extra flag in front of the first column as the seed point to get started and handle empty string vs "**" cases.
  • For each char in p, scan and update the flags in the following way:
    • If it is a '*', current flag should be true if previous flag is true or previous flag in the row above (value at top left) is true. In another word, all flags turn true after first true flag on previous row.
    • If it is a '?' or a matching character as s in same spot, current flag should be the same as previous flag in the row above (value at top left).
    • Otherwise it is a no.
  • Keep the extra flag in the front true only if we kept getting '*'
  • Need some tricks to cache that top left value since we are not saving the full matrix. If you are young and have really good memory, you can of course keep the entire (M+1)xN matrix to keep things simple.
  • If we can reach bottom right corner, we are the lucky mouse who found the exit. Understand the matrix above, you will understand everything. Say cheese :)

Screenshot (333)

Related Issue

Acceptance Criteria

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
💯 Add tests
🔗 Update dependencies
📜 Docs

Testing Steps / QA Criteria

@DugarRishab DugarRishab merged commit 9b736a0 into DugarRishab:main Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants