Reverse words in a string | Leetcode problem 151

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

Пікірлер: 28

  • @rajdeeppatil3623
    @rajdeeppatil36233 күн бұрын

    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
    @thulasiramans63386 ай бұрын

    Your's teaching is excellant mam. Put more videos mam. And I humbly request to give time complexity for the each problem

  • @godwinmensah1230
    @godwinmensah123011 ай бұрын

    Fantastic

  • @naveennaidu4855
    @naveennaidu48559 ай бұрын

    How can we write without split function

  • @vikasvarshney1681
    @vikasvarshney168127 күн бұрын

    Good explanation.!!

  • @Raja-py2lb
    @Raja-py2lb Жыл бұрын

    Keep teaching mam😊

  • @vivekmalviya3036
    @vivekmalviya30362 ай бұрын

    Thank u mam

  • @VinaySangem
    @VinaySangem3 ай бұрын

    mam ,plz maintain git link to store all codes

  • @ka23853
    @ka2385311 ай бұрын

    Love your explanation ❤

  • @shashiprakash-a2539
    @shashiprakash-a2539 Жыл бұрын

    Nice 👍👍👍👍 ma'am 🥰 you

  • @VinaySangem
    @VinaySangem3 ай бұрын

    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
    @kandukuriveeranikhil732810 ай бұрын

    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
    @mohdarshad94274 ай бұрын

    stack can be a better

  • @ashokkumar-nb8ri
    @ashokkumar-nb8ri3 ай бұрын

    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(.)