feat(hackerrank): IBM HackerRank Assessment 2026#4
Merged
shortthirdman merged 2 commits intomainfrom Mar 13, 2026
Merged
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
Code Coverage
|
Contributor
Code Coverage
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Overview
This pull request introduces a spam classification solution implemented in Java as part of the IBM HackerRank Assessment 2026. The implementation focuses on identifying spam messages based on the presence of predefined spam indicator words within a collection of input texts.
Two approaches are provided:
Both implementations normalize input using case-insensitive comparison and classify texts as
spamornot_spambased on the presence of at least two spam-indicator words in a message.Key Features
Spam detection logic
spamwhen ≥ 2 spam indicator words are detected.Two processing strategies
Sequential implementation
Parallel stream implementation
parallelStream()for improved performance on large input sets.Efficient lookups
HashSetto achieve O(1) average lookup time.Memory-conscious design
Testing
A comprehensive JUnit 5 test suite has been added covering:
Functional Tests
Edge Cases
Negative Tests
split(" ")behavior)Parallel Consistency
Performance Considerations
classifyTextsclassifyTextStreamThe stream implementation uses
.limit(2)to avoid unnecessary processing once the spam threshold is reached.Complexity
Time Complexity
Average case: O(n × m)
n= number of textsm= average number of words per textSpace Complexity
O(s + n)
s= number of spam wordsn= number of textsFuture Improvements
Potential enhancements include:
Summary
This PR provides a clean, performant, and well-tested spam classification implementation aligned with modern Java practices, offering both sequential and parallel processing strategies while ensuring correctness through a comprehensive test suite.