Skip to content

Conversation

@0xsatoshi99
Copy link
Contributor

Implements Boyer-Moore Majority Vote algorithm for finding majority elements in O(n) time and O(1) space.

Includes 10 test cases covering edge cases and various scenarios.

Contribution by Gittensor, learn more at https://gittensor.io/

@0xsatoshi99 0xsatoshi99 requested a review from siriak as a code owner November 6, 2025 00:52
@0xsatoshi99 0xsatoshi99 force-pushed the add-boyer-moore-majority-vote branch from 90953e6 to 2d98762 Compare November 6, 2025 00:55
@0xsatoshi99
Copy link
Contributor Author

@siriak , I've made one algorithm and made PR for review, please check and let me know if you have any feedback, Thanks.

@siriak
Copy link
Member

siriak commented Nov 6, 2025

Please fix the issues Codacy found

- Add curly braces to single-statement if blocks (lines 16, 28)
- Split multi-statement lines into separate lines (lines 16, 28)
- Declare variables separately instead of comma-separated (line 24)
@0xsatoshi99
Copy link
Contributor Author

@siriak I've fixed all issues what Codacy found for this PR also, please check it again, Thanks.

- Change null check from 'nums?.Length == 0' to 'nums == null || nums.Length == 0'
- Fixes NullReferenceException when passing null array
@0xsatoshi99 0xsatoshi99 force-pushed the add-boyer-moore-majority-vote branch from 4dd44c3 to 94b4f75 Compare November 10, 2025 09:24
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@e6bf302). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #560   +/-   ##
=========================================
  Coverage          ?   96.86%           
=========================================
  Files             ?      289           
  Lines             ?    11903           
  Branches          ?     1717           
=========================================
  Hits              ?    11530           
  Misses            ?      237           
  Partials          ?      136           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak enabled auto-merge (squash) November 10, 2025 11:44
@siriak siriak merged commit ef3f6e6 into TheAlgorithms:master Nov 10, 2025
4 checks passed
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