Reverse Sentence By Words - Logic Building Practice

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024

ความคิดเห็น • 32

  • @mohanrajdandy
    @mohanrajdandy ปีที่แล้ว

    I have one string called mohan@raj which is the input and the output should be raj@mohan. Can you please write the logic for this

  • @SahanasAllinOneChannel
    @SahanasAllinOneChannel 6 หลายเดือนก่อน +1

    String s="Welcome to CloudTech";
    String[] sArray=s.split(" ");
    StringJoiner sj=new StringJoiner(" ");
    for(int i=sArray.length-1; i>=0;i--) {
    sj.add(sArray[i]);
    }
    System.out.println(sj.toString());

  • @proxy5061
    @proxy5061 ปีที่แล้ว

    Great bro, I thot same logic before clicking on vedio , please bring more on same level

  • @harshavanama4388
    @harshavanama4388 ปีที่แล้ว +5

    solve more complicated problem, like for example Welcome,to+CloudTech!All. String should return All,CloudTech+to!Welcome(only worlds should reverse special characters should remain at the same position)

    • @abhinandeshwar6335
      @abhinandeshwar6335 ปีที่แล้ว

      Hi, harsha,
      Then you'll have changes in split condition right?

    • @harshavanama4388
      @harshavanama4388 ปีที่แล้ว

      @@abhinandeshwar6335 split won't work here. It's a more complicated solution

    • @nayyarrabbani8518
      @nayyarrabbani8518 ปีที่แล้ว

      @@harshavanama4388 And do you know how to solve that problem ? If yes, can you drop down any reference.!

    • @harshavanama4388
      @harshavanama4388 ปีที่แล้ว

      Well I am thinking of using couple of arrays and add words in one array and symbols in another one and then finally merging both of those arrays, one should be reversed(words array). But thats just my idea, I have to write code and see if it works or not

    • @nayyarrabbani8518
      @nayyarrabbani8518 ปีที่แล้ว

      @@harshavanama4388 Great one brother, are you on linkedin.?

  • @animeshnaik2345
    @animeshnaik2345 ปีที่แล้ว +1

    3 times?

  • @bhargavi4557
    @bhargavi4557 10 หลายเดือนก่อน

    How to do this in java8

  • @swabhaviwagh2718
    @swabhaviwagh2718 ปีที่แล้ว

    For loop will execute 3times

  • @gopalkannan4934
    @gopalkannan4934 ปีที่แล้ว

    Thank you!!

  • @chandan07talreja
    @chandan07talreja ปีที่แล้ว

    Can you upload a similar video using streams and not using the default reverse order method available in streams.

  • @ripusudansoni3366
    @ripusudansoni3366 ปีที่แล้ว +1

    3

  • @maharudra947
    @maharudra947 ปีที่แล้ว +1

    5 = 3 words + 2 spaces

    • @Praveenkumar-hg9ir
      @Praveenkumar-hg9ir ปีที่แล้ว +1

      No, its wrong.. for loop run for N times, where N is length of words - so, it is 3

  • @VikashYadav-px8ei
    @VikashYadav-px8ei ปีที่แล้ว +1

    3 times

  • @chetansinghphogat3195
    @chetansinghphogat3195 ปีที่แล้ว +1

    5 (Beacuse of appending space)

    • @cloudtech5260
      @cloudtech5260  ปีที่แล้ว +1

      Hi Chetan,
      It is 3, as we have 3 words in the sentence.

  • @GoogleAccount-ph8mm
    @GoogleAccount-ph8mm ปีที่แล้ว

    Please put java program using dynamic programming

  • @AK-fh8tg
    @AK-fh8tg ปีที่แล้ว

    5

  • @mominuber
    @mominuber ปีที่แล้ว

    //Le javascript
    let str=prompt("Enter a string to reverse")
    console.log(str.split(' ').reverse().join(' '));

  • @VirtualPopsterofficail
    @VirtualPopsterofficail 8 หลายเดือนก่อน

    3 times

  • @batlanki-jj7ht
    @batlanki-jj7ht ปีที่แล้ว

    3