Leetcode 151 | Reverse words in a string | 6th from LC 75 | 90 days SE prep

preview_player
Показать описание

About the Video -
I am simulating a scenario to create content. I will be preparing for a SE job across the next 90 days or so, till Mar 31 2024. I have created a preparation plan for that. Let's do it together.

This is 6th from Leetcode 75
Question number is Leetcode 151.
Question name is "Reverse words in a string"

I am doing the following work these days
5. Journal of progress:

My instagram, linkedin and twitter are also pretty interesting.

Lift weights. Be Curious. Dream and Build,
Sumeet
Рекомендации по теме
Комментарии
Автор

Thanks learnt a new thing
I don't know that sb that mean string builder
sb.substring(0, len-1)

Kaafirpeado-ayesha
Автор

List<String >words =Arrays.asList (s.trim().split("\\s+");
Collections.reverse(words);
return String.join(" ", words);

dayashankarlakhotia
Автор

Sir, would you mind posting a solution which don't use any in-built function and explain the thought process behind it?

shreyanshtomar
Автор

sir, this is not O(1) right ? because string builder is used

sanjanachowdary