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)
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
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
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());
Great bro, I thot same logic before clicking on vedio , please bring more on same level
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)
Hi, harsha,
Then you'll have changes in split condition right?
@@abhinandeshwar6335 split won't work here. It's a more complicated solution
@@harshavanama4388 And do you know how to solve that problem ? If yes, can you drop down any reference.!
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
@@harshavanama4388 Great one brother, are you on linkedin.?
3 times?
How to do this in java8
For loop will execute 3times
Thank you!!
Can you upload a similar video using streams and not using the default reverse order method available in streams.
3
5 = 3 words + 2 spaces
No, its wrong.. for loop run for N times, where N is length of words - so, it is 3
3 times
5 (Beacuse of appending space)
Hi Chetan,
It is 3, as we have 3 words in the sentence.
Please put java program using dynamic programming
5
Noo 3
//Le javascript
let str=prompt("Enter a string to reverse")
console.log(str.split(' ').reverse().join(' '));
3 times
3