Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement LengthOfLastWord algorithm and add JUnit tests#7057

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
gopaljilab wants to merge2 commits intoTheAlgorithms:master
base:master
Choose a base branch
Loading
fromgopaljilab:master

Conversation

@gopaljilab
Copy link

Summary

This pull request introduces theLengthOfLastWord algorithm under thestrings package.
It also includes comprehensive JUnit test coverage to ensure correctness and reliability.

Details

  • LengthOfLastWord.java
    Implements a method to compute the length of the last word in a given string.
    The algorithm efficiently traverses the string from the end to handle trailing spaces.

  • LengthOfLastWordTest.java
    Adds JUnit tests covering various scenarios, including:

    • Strings with trailing spaces
    • Single-word inputs
    • Multiple-word inputs
    • Empty string edge case

Checklist

  • Code follows the repository’s naming and structural conventions
  • Includes Javadoc-style documentation
  • Added unit tests for all relevant cases
  • Verified all tests pass locally using./gradlew test

Example

Input: "Hello World"
Output: 5

@gopaljilab
Copy link
Author

👋 Hello, this is my first open-source contribution!
I’ve implemented the LengthOfLastWord algorithm under the strings package and added JUnit tests for validation.
Please review and let me know if any improvements are needed.
Thank you for maintaining this amazing repository! 🙏

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.35%. Comparing base (0837424) to head (7068e54).
⚠️ Report is 35 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@##             master    #7057    +/-   ##==========================================  Coverage     78.34%   78.35%- Complexity     6621     6676    +55==========================================  Files           747      754     +7       Lines         22036    22194   +158       Branches       4322     4358    +36     ==========================================+ Hits          17264    17390   +126- Misses         4085     4105    +20- Partials        687      699    +12

☔ 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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@DenizAltunkapanDenizAltunkapanAwaiting requested review from DenizAltunkapanDenizAltunkapan is a code owner

@yanglbmeyanglbmeAwaiting requested review from yanglbmeyanglbme is a code owner

@alxkmalxkmAwaiting requested review from alxkmalxkm is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@gopaljilab@codecov-commenter

[8]ページ先頭

©2009-2025 Movatter.jp