Repository navigation
refactor(bitmanipulation): simplify XOR reduction responsibility in N… - #46
Open
Sapna2007-sst wants to merge 1 commit into
Open
Sapna2007-sst wants to merge 1 commit into
Sapna2007-sst wants to merge 1 commit into
Conversation
…onRepeatingNumberFinder (R45-T006) - Extract reduceXor helper method separating public API entry point from sequential XOR accumulation - Rename accumulator from generic result to self-documenting xorSum - Add regression tests covering smallest valid input (empty array and single element), ordinary input documentation fixture [2, 3, 5, 2, 3], negative numbers, null precondition, and reflection contract - Add automated verification check runner work/R45-T006/check.py and verification evidence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request refactors
NonRepeatingNumberFinderto simplify and isolate the sequential bitwise XOR accumulation responsibility into an extractedreduceXorhelper method with self-documenting naming, while locking down regression behavior across edge cases and fixtures.Related Issue
Fixes: #6
Type of Change
Changes Made
reduceXor(int[] arr)insrc/main/java/com/thealgorithms/bitmanipulation/NonRepeatingNumberFinder.javaisolating bitwise accumulation from the public API entry point.resultto descriptivexorSum.src/test/java/com/thealgorithms/bitmanipulation/NonRepeatingNumberFinderTest.javawith tests covering:new int[] {}returning0).new int[] {12}returning12).new int[] {2, 3, 5, 2, 3}returning5).new int[] {-42, 99, -42}returning99).NullPointerException.work/R45-T006/check.pyand saved verification evidence inwork/R45-T006/results.jsonandwork/R45-T006/evidence.md.Screenshots / Recordings
N/A (bit manipulation utility and unit tests; non-UI)
Testing
All changes have been validated locally using JDK 21 and Maven:
mvn test -Dtest=NonRepeatingNumberFinderTest(Tests run: 15, Failures: 0, Errors: 0, Skipped: 0)mvn checkstyle:check(0 Checkstyle violations)python3 work/R45-T006/check.py(All checks and refactoring assertions passed successfully)Checklist
mvn checkstyle:check.Additional Notes
work/R45-T006/evidence.md.python3 work/R45-T006/check.py.