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

feat: Implement FixEquation class for fixing an equation with a missing Digit #46

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

Conversation

neha-93
Copy link

@neha-93 neha-93 commented Dec 8, 2021

Brief Explanation

Time Complexity - O(N), N = length of expression
Space Complexity - O(1)

  • Declared a function in class FixEquation for finding the missing digit.
  • Created a function to run the given test cases in the documentation.

Approach

  • The equation is split into numbers using regular expression (/[+,*,=,]/)
  • Out of the numbers found out the number which has a missing digit by checking the presence of '?'
  • Found out the Number which has a missing digit with the help of valid Numbers.
  • Checked if the number found is valid or not and returned the result appropriately.

Link to the solution: https://github.com/neha-93/Github-Externship-Assignment/blob/main/Solution.js

image

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.

None yet

1 participant