Reverse words in a string | Leetcode problem 151

  Рет қаралды 30,365

Technosage

Technosage

Жыл бұрын

Reverse words in a String
Leetcode problem number 151
JAVA interview programming playlist:
• Interview Programming ...
#java #interviewquestions #leetcode

Пікірлер: 28
@rajdeeppatil3623
@rajdeeppatil3623 3 күн бұрын
such a sweet and simple solution, thank q mam.
@inspiremusicandinspirephar5228
@inspiremusicandinspirephar5228 Жыл бұрын
hats off to your dediication towards your work and professionalism
@TechnosageLearning
@TechnosageLearning Жыл бұрын
Thankyou!!💐
@anshumankumarnathshahdev3090
@anshumankumarnathshahdev3090 Жыл бұрын
thanks for the beautiful explanation . also your voice was very pleasent to my ears .
@thulasiramans6338
@thulasiramans6338 6 ай бұрын
Your's teaching is excellant mam. Put more videos mam. And I humbly request to give time complexity for the each problem
@godwinmensah1230
@godwinmensah1230 11 ай бұрын
Fantastic
@naveennaidu4855
@naveennaidu4855 9 ай бұрын
How can we write without split function
@vikasvarshney1681
@vikasvarshney1681 26 күн бұрын
Good explanation.!!
@Raja-py2lb
@Raja-py2lb Жыл бұрын
Keep teaching mam😊
@vivekmalviya3036
@vivekmalviya3036 2 ай бұрын
Thank u mam
@VinaySangem
@VinaySangem 3 ай бұрын
mam ,plz maintain git link to store all codes
@ka23853
@ka23853 11 ай бұрын
Love your explanation ❤
@shashiprakash-a2539
@shashiprakash-a2539 Жыл бұрын
Nice 👍👍👍👍 ma'am 🥰 you
@VinaySangem
@VinaySangem 3 ай бұрын
mam why we are using + for s.split(" ");
@kishnersuperbannumiyer7383
@kishnersuperbannumiyer7383 3 ай бұрын
+ means any number of spaces ko break krna
@Jai_Jai_shri_Ram108
@Jai_Jai_shri_Ram108 Жыл бұрын
In this question given space complexity: o(1)
@amritabill3306
@amritabill3306 Жыл бұрын
Hello, The problem says, "if string data type is mutable in your language, can you solve it in place with O(1) extra space" Since here the problem is solved using JAVA, where the Strings are immutable in nature.
@Jai_Jai_shri_Ram108
@Jai_Jai_shri_Ram108 Жыл бұрын
@@amritabill3306 ok
@kandukuriveeranikhil7328
@kandukuriveeranikhil7328 10 ай бұрын
Mam while executing the same we are getting errors mam ( : , s,regex , its showing as illegal expressions ) and while we are taking the inputs from user also we are facing the issue
@TechnosageLearning
@TechnosageLearning 10 ай бұрын
Hi Can you please copy the code from git repo and give it a try..you might be missing something while writing regex
@rjsuryavanshi922
@rjsuryavanshi922 3 ай бұрын
no need to write regex as it is automatically done by ide in intelliJ
@mohdarshad9427
@mohdarshad9427 4 ай бұрын
stack can be a better
@ashokkumar-nb8ri
@ashokkumar-nb8ri 3 ай бұрын
Hi, I am trying to do reverse the words which is separated by dot. Here is an example and code String inp = " Welcome.to.Java.Programming "; static String reverseWords(String str) { String rev =""; str = str.trim(); String[] words = str.split("\\."); StringBuilder sb = new StringBuilder(); for (int i = words.length -1 ; i >= 0; i--) { sb.append(words[i]); sb.append("."); } return sb.toString().trim(); } Output: Programming.Java.to.Welcome. I could see dots are getting added for each iteration which makes the incorrect output. Could you please check and suggest me how to handle the situation
@chetankumar5190
@chetankumar5190 3 ай бұрын
you are appending dots that's why they are appearing sb.append(".")
@ashokkumar-nb8ri
@ashokkumar-nb8ri 3 ай бұрын
⁠@@chetankumar5190 yes I am appending the dot, because input string is with dot. So I want to reverse the words and append the dots too. Like how they append the space in this video But my question is when appending its appending after last word also Check out the output in my comment
@chetankumar5190
@chetankumar5190 3 ай бұрын
More what, u want dot or not
@ashokkumar-nb8ri
@ashokkumar-nb8ri 3 ай бұрын
@@chetankumar5190 I am expecting below output Programming.Java.to.Welcome
@chetankumar5190
@chetankumar5190 3 ай бұрын
Add condition If(i!=s.length()-1) sb .append(.)
Palindrome Number | Leetcode problem 9
6:57
Technosage
Рет қаралды 26 М.
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 18 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 23 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 24 МЛН
Happy 4th of July 😂
00:12
Alyssa's Ways
Рет қаралды 65 МЛН
Reverse Words in a String | LeetCode 151 | C++, Java, Python
13:58
Knowledge Center
Рет қаралды 170 М.
Java Program to Reverse each Word of a String
5:49
Programming Tutorials
Рет қаралды 86 М.
Reverse Words in a String in Java
4:05
Telusko
Рет қаралды 175 М.
Reverse Words in a String III - Leetcode 557 - Python
10:18
NeetCodeIO
Рет қаралды 15 М.
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 18 МЛН