Skip to content

refactor: clean long division code #5776

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

Closed
wants to merge 2 commits into from
Closed

refactor: clean long division code #5776

wants to merge 2 commits into from

Conversation

saahil-mahato
Copy link
Contributor

Description

There was a redundant code block in LongDivision.java. This PR simply deletes it and does a few minor code quality modifications.

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.13%. Comparing base (9b52ac9) to head (4769e6e).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5776      +/-   ##
============================================
- Coverage     64.14%   64.13%   -0.01%     
+ Complexity     4205     4204       -1     
============================================
  Files           587      587              
  Lines         16390    16384       -6     
  Branches       3163     3161       -2     
============================================
- Hits          10513    10508       -5     
  Misses         5448     5448              
+ Partials        429      428       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@saahil-mahato saahil-mahato marked this pull request as ready for review October 13, 2024 12:44
}
answer.append(quotient);
} else if (part1 == newDivisor1) {
if (part1 >= newDivisor1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove it? Maybe it wasn't covered by tests? Because it seems to be inefficient but requires code.

Perhaps this could be written more efficiently, like this:

    int quotient = (int) (part1 / newDivisor1);
    part1 = part1 % newDivisor1;
    answer.append(quotient);

@saahil-mahato saahil-mahato closed this by deleting the head repository Oct 27, 2024
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.

3 participants