Find the Length Of Last Word in a String | LeetCode Java Program | Interview Question Answers

preview_player
Показать описание
In this video, we demonstrated how to find the length of the last word in a string.

Input String - welcome to cloudtech
Output - Length of Last word is 9

Complete Java Interview Preparation:

#leetcode
#java
#interview
#javaprogramming
#javacoding
#javainterviewquestions
Рекомендации по теме
Комментарии
Автор

Thank you sir for making such as videos. I am a student and I just start the learning java, it's very useful for me and so many others. Keep it up...!

sanketpilane
Автор

String str = "beautiful life";
int len = 0;
String s = str.trim();
for (int i = 0; i<s.length();i++) {
if (s.charAt(i)== ' ')
len = 0;
else
len++;
}
System.out.println(len);

pravincreation
Автор

this logic is so sweet ❤️❤️❤️..
I thought much more logic 😂😂..
thank you dude . 🥳🥳🥳🥳

hemasundarkasturi
Автор

Thanks bro...keep it up..i m from nonit branch..ur videos helps me alot✌️

Riteshkumar-ihfj
Автор

package com.method;

public class LengthOfLastWord
{
public static void main(String[] args) {
String str="welcome to java satish";

String[] split = str.split(" ");

for(int i=0;i<split.length;i++)
{
if(i==split.length-1)
{

}
}
}
}

satishbhutawale
Автор

public static void main(String[] args) {
String str = "Welcome to cloudtech";
String []arr = str.trim().split(" ");
System.out.println("Length of last word :
}
This is my solution. Thanks.

inhsonngo
Автор

String split, loop last world, count it the last world 🤘

proxy
Автор

Bro i faked my experience and my current company is assigning jira task and all going above my head what to do?

dreamplaying-wgjn
Автор

public class Main {
public static void main(String[] args) {
String s[]="welcome to cloudtech".split(" ");
System.out.println("Length of last word is "+s[s.length-1].length());
}
}

This is another easy way to solve it....

manatechnologyManu
Автор

Why always programs on strings only?
Make different Programs on different topics

Abzalkhan
welcome to shbcf.ru