Skip to content
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

[PROBLEM] 58. Length of Last Word #201

Open
godkingjay opened this issue Oct 30, 2023 · 1 comment · Fixed by #204
Open

[PROBLEM] 58. Length of Last Word #201

godkingjay opened this issue Oct 30, 2023 · 1 comment · Fixed by #204
Assignees
Labels
difficulty: easy Easy difficulty problem. hacktoberfest Hacktoberfest issue. problem LeetCode problem.

Comments

@godkingjay
Copy link
Owner

Difficulty

Easy

Problem Description

Given a string s consisting of words and spaces, return the length of the last word in the string.

A word is a maximal

substring
consisting of non-space characters only.

Example 1:

Input: s = "Hello World"
Output: 5
Explanation: The last word is "World" with length 5.

Example 2:

Input: s = "   fly me   to   the moon  "
Output: 4
Explanation: The last word is "moon" with length 4.

Example 3:

Input: s = "luffy is still joyboy"
Output: 6
Explanation: The last word is "joyboy" with length 6.

Constraints:

  • 1 <= s.length <= 104
  • s consists of only English letters and spaces ' '.
  • There will be at least one word in s.

Link

https://leetcode.com/problems/length-of-last-word/

@godkingjay godkingjay added hacktoberfest Hacktoberfest issue. problem LeetCode problem. difficulty: easy Easy difficulty problem. labels Oct 30, 2023
@HamnaJabbar
Copy link
Contributor

Hi @godkingjay ! I have done the task and made a PR. Have a look.

@godkingjay godkingjay linked a pull request Oct 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy Easy difficulty problem. hacktoberfest Hacktoberfest issue. problem LeetCode problem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants