-
Notifications
You must be signed in to change notification settings - Fork 20k
Create LongDivision.java #3691
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
Create LongDivision.java #3691
Conversation
It's not a simple division, it's a division which is implemented using Long Division Principle, which saves us a lot of time, where some users approach using while loop.
Add Some JUnit test |
I did: |
Test and Main are combined, all the errors were fixed, please kindly review, thank you |
Requesting review from @siriak and @yanglbme and @debasishbsws for approval and merging. |
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.
Is this a well-known computer science problem and algorithm? Please add some links to problem statement and algorithm explanation
Here is the problem Problem |
Then please call it LongDivision and add a link to Wikipedia |
Here is my own implementation of the Long Division for 2 integers https://en.wikipedia.org/wiki/Long_division
I have a left a source and short description in the Main Java class and added a comment, also the name of the Class was changed |
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.
@siriak Long division is an algorithm to divide long numbers, in small step-by-step from. It doesn't make any sense if the inputs are bounded to only integers. input and output should be in a string so that very big size numbers can be divided using this.
This my 1st attempt by using integers only, I can write a code in a future and update the current method, which will accept numbers as strings, cause initially it was and integer division by long division method. The reason that I cannot apply the long numbers, is because in the problem I can't use * nor / operators |
Can you please add hackoberfest tag, it was indeed difficult problem, I will update this method, however deadline is today for hacktoberfest, thank you |
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.
Looks good, thanks!
It's not a simple division, it's a division which is implemented using Long Division Principle, which saves us a lot of time, where some users approach using while loop.