finally I'm completed my core java, lots of respect/appreciation to you shraddha mam & your team 👍
@saikatghosh67612 жыл бұрын
if we have to do the reverse process without using function then we can do it more easily with am empty string and for loop. String s="Saikat"; String rev=""; for(int i=s.length()-1;i>=0;i--){ rev += s.charAt(i); }
@bhat_hazim2 жыл бұрын
sb.reverse(); sout(sb); 😀
@HassanRaza-BSCS-20192 жыл бұрын
is much more easy..... StringBuilder sb=new StringBuilder ("hello"); sb.reverse(); System.out.println(sb);
@keerthikakudali65205 ай бұрын
@@bhat_hazimlol😂
@shivamKumar-ys5rr5 ай бұрын
bro it's time complexity and space complexity is more than the code givn by mam
@navamsharma18885 ай бұрын
Good.
@sumitchoudhary47332 жыл бұрын
Whatever i will write for Shraddha is always a less. All i can say really appreciate for your effort to put across tough things in simpler way. And explanation in Hindi can be so good that i never thought off. Thanks to everyone who put there effort right from concept wise ,edit wise, teaching wise . You will definitely savior for many of us in terms of basic concepts clearing. kudos to entire team once again.
@deepakrawat25192 жыл бұрын
finally i had completed till now.. thanks too you maam and sir ❤
@harshcarpenter6370 Жыл бұрын
For reversing a string simplest way will be: StringBuilder sb = new StringBuilder("Tony"); StringBuilder sb1 = new StringBuilder(""); for(int i = sb.length()-1; i>=0; i--){ sb1.append(sb.charAt(i)); } System.out.println(sb1);
@RahulKumar-oj3cf Жыл бұрын
Maybe simplest but not optimized, takes more time and memory.
@crackheadweirdo6368 Жыл бұрын
We can also do it without creating an extra stringbuilder , just by editing on the same stringbuilder ig.... that's more efficient and memory saving
@Roshni_Parashar Жыл бұрын
import java.util.*; public class reverseString { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String word= sc.next(); for(int i=word.length()-1;i>=0;i--) { System.out.print(word.charAt(i)); } } } this is also a another way and easy also.
@shubhalagadam7496 Жыл бұрын
You are storing one String to another one, not reversing.
@riteshgupta4908 Жыл бұрын
I also thought of similar logic, but most efficient way is to just create a StringBuilder and use reverse() method
@Arshad_mirza0072 ай бұрын
Easy Cheezzzyyyy 😊 StringBuilder rev = new StringBuilder("Hello"); int i=0; int j=rev.length()-1; while(i
@naag48523 жыл бұрын
We can also use reverse() method in StringBuilder to reverse a string😁
@saadmayo88222 жыл бұрын
HAHA! Mene bhi reverse () function hi use Kia tha phir me yeh Soch rha tha keh yeh itna bara code kue likh rhi ha..
@swarajhegde90592 жыл бұрын
@@saadmayo8822 arey matlab job interviews me without functions karna padta hai bro...They will test your logic building ability
@soumyajitghosh90552 жыл бұрын
🤣 mein bhi use kia reverse()
@soumyajitghosh90552 жыл бұрын
@@swarajhegde9059 bro Agar ek 10 min ka kam pe tum pura din leloge toh koi tumhe job nhi dega.
@swarajhegde90592 жыл бұрын
@@soumyajitghosh9055 arey Bhai 😂...me real time interview experience Ka Bola ...interview me Bina function use kiye Karke dikhao Karke puchenge... interviewers check your logic ... Jo bhi function Tu use karega na ..wo function create Karne keliye BHI logic chayiye na 😂...when you develop something from scratch ,you need to build logic for that problem to get solution ... they check how well you can build your problem solutions
@harshsahu3734 Жыл бұрын
After watching multiple videos,I finally understood to reverse a string through your video
@siddharthsharma51623 жыл бұрын
Please upload all the lecture ASAP . Waiting for Data Structure and Algorithm part..
@siddheshsakpal57982 жыл бұрын
1) Reverse String using string builder using inbuilt function. String s2= String.valueOf(s1.reverse()); System.out.println(s2);
@mdakhan7400 Жыл бұрын
She taught us without using any function bro with the help of loops and basic method but yeah a function could be used for time complexity
@AmarKumar-nf3nn Жыл бұрын
@@mdakhan7400 this one is better then StringBuilder sb = new StringBuilder("Tony Stark"); for(int i=sb.length(); i>=0; i--) { System.out.print(sb.chatAt(i)); }
@Agnos15 Жыл бұрын
@@AmarKumar-nf3nn sb.length()-1* and sb.charAt(i)*
@shaikasad-yn8he2 ай бұрын
@@AmarKumar-nf3nn bhai iss loop ko explain karo thoda sa plz for(int i=word.length()-1;i>=0;i--)
@AmarKumar-nf3nn2 ай бұрын
@@shaikasad-yn8he int i = 0; i < sb.length() - 1; i++; Just reverse it, start from last index and go to 1st index like int i = sb.length() - 1; i >= 0; i--;
@005_adityaraghuvanshi63 жыл бұрын
Thank you very much 💐❤️ for providing such valuable information . Finally I'm able to learn coding 😀
@RajanGupta-cj4zm3 жыл бұрын
Frm where u studied??
@005_adityaraghuvanshi63 жыл бұрын
@@RajanGupta-cj4zm from this channel
@prasenjitnayak_3 жыл бұрын
kzbin.info/www/bejne/jH-lmaeresumb7c
@chandankumarnandan52132 жыл бұрын
Ye aisa channel hai jise dekhker mujhe utni hi kushi hoti hai jaise kisi chote bacche ko Doraemon dekhker...🎉🎉😀😀
@mohammadajazvlogs52893 ай бұрын
public class Strings{ public static void main(String[]args){ String builder r =new StringBuilder("Apana College"); System.out.println(r.reverse()); } } Output:----- egelloC anpA
@Gamer_00572 жыл бұрын
19:48 Didi, we can also reverse a string by - public class sbTest{ public static void main(String[] args) { StringBuilder sb = new StringBuilder("hello"); StringBuilder newSb = new StringBuilder(" "); int j = 0; for(int i = sb.length()-1;i>=0;i--){ newSb.insert(j, sb.charAt(i)); j++; } System.out.print(newSb); }
@naveen-kd2uh2 жыл бұрын
🎉🎉
@vickyboss96872 жыл бұрын
Thanks buddy
@shlokgupta4317 Жыл бұрын
she is showing how to reverse in the same string variable .... if we have to use other variable then there is no need of setbuilder so that's why she presented in that way
@ramaplayz6934 Жыл бұрын
StringBuilder opposite=new StringBuilder(hello); opposite.reverse(); System.out.println(opposite); ye zada asan hai bhai
@Balaji-wb7cp Жыл бұрын
🎉🎉🎉🎉🎉
@beingaliveshow49222 жыл бұрын
Aapse to koi begginner wala insaaan kbhi seekh hi nhi skta kuch.
@RealJ16596 ай бұрын
Apna college's regular students will understand Shraddha didi's obsession with Tony Stark 😅😂😂
@naheedaparveen68133 жыл бұрын
Didi please upload all the lectures as fast as you can. Thank you!!!
@dewangsingh33763 жыл бұрын
I din m 2 ya 3 kro
@abcbde82833 жыл бұрын
@@dewangsingh3376 bhai patience rakho video banane me samy aur mehnat aur bhut preparation lagta h aayegi
@dewangsingh33763 жыл бұрын
@@abcbde8283 team work naam ki ek cheez hove hai
@Elif_shk2 жыл бұрын
From were u learn java
@JAY_VEGAD8 ай бұрын
For Reverse the String Easy Way String name = "Tony"; for(int i = name.length() - 1 ; i > = 0 ; i - - ) { System.out.print(name.charAt(i)); }
@SkandGupta-12 жыл бұрын
for reversing the string you can also do this simple method class FirstClass { public static void main(String[] args) { StringBuilder name = new StringBuilder("Hello"); for(int i = name.length()-1;i>=0;i--){ System.out.print(name.charAt(i)); }}}
@ashwinikumar79652 жыл бұрын
Smjha ni Isme replace ka to kuch m h
@nitinduke2 жыл бұрын
it is not actually replacing the string your are just printing theme in reverse order.which it is still same in the code you just show character by character in the reverse order on the console without nextline
@swarajhegde90592 жыл бұрын
@@nitinduke this will help String name="hello"; StringBuilder name2=new StringBuilder(""); int size=name.length()-1; for(int i=size;i>=0;i--){ name2.append(name.charAt(i)); } System.out.println(name2); yeh easy hai but didi ka efficient hai bcoz it has n/2 iterations and this code has n iterations..
@shaikasad-yn8he2 ай бұрын
@@swarajhegde9059 bhai a length()-1 ka kya matlab hai explain plz
@swarajhegde90592 ай бұрын
@@shaikasad-yn8he basically when someone does length()-1 tho yeh Samaj lena ki length() function jo output dega usse 1 minus ho rha hai. For example name="rahul" Name.length() karne pe rahul name ka length miljayega.. abhi yeh length ko aap apne loop me kaise use karenge wo aap pe depend hai. You can do -1,-2 ,-3 Kitna bhi minus kar sakte ho .use it according to your needs
@aryanjsangwai25822 ай бұрын
Instead of front and back character we can simply do reverse for loop and return the reverse string using charAt public class reverstring { public static void main(String[] args) { StringBuilder sb=new StringBuilder("nayra"); System.out.println(sb); int n=sb.length(); for(int i=n-1;i>=0;i--){ System.out.print(sb.charAt(i)); it will display "aryan"
@Fayroll5Ай бұрын
StringBuilder sb = new StringBuilder("nayra"); sb.reverse(); System.out.println(sb);
@AIYouTubeTricks11 ай бұрын
14:38 Reverse a String : StringBuilder str = new StringBuilder("APNA COLLEGE"); str.reverse(); System.out.println(str); OUTPUT: EGELLOC ANPA
@AIYouTubeTricks11 ай бұрын
Very easy 👍🏻
@kunalkheeva2 жыл бұрын
Took me two days to completely get it, even though it was explained so well. Thank you didi.
@csea_37_shayoribhowmick532 жыл бұрын
Same here
@csea_37_shayoribhowmick532 жыл бұрын
Thought I was the only person learning late
@anuragsanadhya93592 жыл бұрын
Hates off to @Apna_college . Really need this kind of contant . Thanks a lot.
@himanshukumarsingh13842 жыл бұрын
you are carrer saver giving free valuable content god bless you
@shortslux96682 жыл бұрын
real fan of tony stark🤣😂
@prathmeshsingh96992 жыл бұрын
Madam your way of explaining is awesome
@sapnanaz-m4l9 ай бұрын
Thankyou so much mam for teaching coding with simple way
@honeyhemanth4012 жыл бұрын
thank you APNA COLLEGE. you guys are great.
@shaikhasifmahebub94603 жыл бұрын
Thanks didi but pura course complete kigiye hume apke video se bahot help hoti hai
@yujityadav30492 жыл бұрын
At 17:00 we can also do by using for loop is just reverse direction like initialising by { name.lengthI()-1 to 0 } considering name as out String and just print 🙃🙃🙃🙃
@earthlover4492 жыл бұрын
By using loop we can just print a string in reverse ,but can't reverse
@swarajhegde90592 жыл бұрын
@@earthlover449 i think this is what he meant --------> String name="hello"; StringBuilder name2=new StringBuilder(""); int size=name.length()-1; for(int i=size;i>=0;i--){ name2.append(name.charAt(i)); } System.out.println(name2); but jo didi ne sikhaya usme kam iterations use hote hai (n/2)...isme n iterations use hote hai...difference is vast when input is big..aisa lagta hai
@empire90442 жыл бұрын
@@swarajhegde9059 bhai isme string reverse nehi hua, given string ki value dusri string mein reverse order mein store hua.. given string ka order same hi reh gaya
@nagendrak48268 ай бұрын
we can just use sb.reverse(); to reverse the string using StringBuilder.....
@pathansohaibhussain82298 ай бұрын
SImple code to reverse the String StringBuilder a = new StringBuilder("aman"); for (int i=a.length()-1;i>=0;i--) { System.out.print(a.charAt(i)); }
@fitnessmasterzain56543 жыл бұрын
Best today video about string ❤️
@arjun48963 жыл бұрын
Bhai abhi video aaye 2 min bhi nahi hue. Aur tune 24 min ki video dekhke usko best bhi bol diya.
@bhavesh0993 жыл бұрын
@@arjun4896 true 😂😂😂 Ye bss promotion k liye h 😂
@fitnessmasterzain56543 жыл бұрын
@@arjun4896 talent bro😂
@tarangsingh9110 Жыл бұрын
Reverse for loop se bhi. Ho jayega for (int i=(sb.length()-1);i>=0;i--){ System.out.print(sb.charAt(i));
@masteradvisor594 Жыл бұрын
function to reverse static StringBuilder reverse( StringBuilder str){ int n = str.length()-1; for( int i=0; i
@nitesh8272 жыл бұрын
We can also reverse it using two pointer method. Startpoint=0; endPoint =n-1; while loop(start
@Ramsharan6472 жыл бұрын
we wont use pointers in java
@mgfun75052 жыл бұрын
Easy way to reverse the string. for(int i= str.length()-1;i>=0;i--) { System.out.print(str.charAt(i));
@pramodpandey64572 жыл бұрын
It is just printing , in video mam has done how to actually reverse the main string ... in your loop as soon as the loop ends ... string gets back to its original value
@moviesmax398 Жыл бұрын
System.out.println("Java is little harder some tricks please");
@rsuryavlogs4984 Жыл бұрын
Reverse string String s ="Hello"; String rev =""; for(int i=0; i
@rsuryavlogs4984 Жыл бұрын
StringBuilder sb = new StringBuilder("hello"); System.out.println(sb.reverse());
@mgkigyanibaate72362 жыл бұрын
bohot pyaara explaination
@aagam69 Жыл бұрын
best way to reverse a string is String reversal= sb.reverse().toString(); System.out.println(reversal);
@Rieshu-s1m10 ай бұрын
#Apna College & shradda didi rocks
@tapanmahata83302 жыл бұрын
Very good explanation
@BhardwajHackology2 жыл бұрын
SIMPLE WAY TO REVERSE STRING : String name = "Himanshu"; int m = name.length(); String reverse = ""; for (int i = m - 1; i >= 0; i--) { reverse += name.charAt(i); } System.out.println(reverse);
@subhamsahani29482 жыл бұрын
we can also write in these form:- import java.util.*; public class Main{ public static void main (String[] args) { String b = ""; Scanner s = new Scanner(System.in); String a = s.next(); for(int i=a.length();i>0;i--){ b+=a.charAt(i-1); } System.out.println(b); } }
@mayankjain56822 жыл бұрын
using extra space is not a recommended solution
@mrutyunjayapradhan3599 Жыл бұрын
Well try bro ❤ but It will take extra space and time 🙂
@sushantbhourjar189 ай бұрын
For reversing all characters of a string can also be done by import java.util.Scanner; public class javaArray { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); StringBuilder sb = new StringBuilder(str); int len = sb.length(); for(int i=len-1;i>=0;i--) { System.out.print(sb.charAt(i)+" "); } } }
@PankajGupta-qb2bt2 жыл бұрын
Thanks Didi for best content 🙂
@AshishSharma-Dev3 жыл бұрын
I think, Simplest approach to reverse a string is - use reverse loop (for i = str.length()-1 till 0)
@saqlainkazi57703 жыл бұрын
that will just print the string in reverse order but the string remains the same
@rajeswariputatunda50932 жыл бұрын
@@saqlainkazi5770 yess but you can add the elements of reverse string loop in a different string using charAt function
@naveenkumarkota20902 жыл бұрын
Keep sharing knowledge shradda
@vortex4900 Жыл бұрын
reversing the string can be done very simply with a basic logic public class str4 { public static void main(String[] args) { String str = "hello"; int length = str.length(); for(int i = length-1;i>=0;i--){ System.out.print(str.charAt(i)); } } }
@nityasrithumu5212 жыл бұрын
please make videos on aptitude and reasoning for campus placements.it will be helpful for palcements in addition to coding.
@venkat66542 жыл бұрын
yes
@geetsahu71912 жыл бұрын
I think this will be more easiest way to reverse a String.... public static void main(String[] args) { String a = "Geet"; for(int i = a.length() - 1 ; i >= 0 ; i --){ System.out.print(a.charAt(i)); } }
@gumball-lazy2 жыл бұрын
buffer reader ko use karke String rev=anystring,Reverse(); use kar sakte ho
@C19-Edits126 ай бұрын
💯🥀 exactly
@Nakshatra_022 ай бұрын
Why did u did? a. Length() -1
@kuldeepyadav9349 Жыл бұрын
didi aap bohot acche se samjati ho but video thoda lamba kr deti thoda short jo ske tou jaroor krna .thanks
@DHEERAJ_R6 ай бұрын
Thank you so much mam ❤️👨💻✅️
@AAKSHAS4 ай бұрын
4:55 String Builder
@gaurisaxena11993 жыл бұрын
Please complete this course as soon as possible....plzzz...
@badalsahoo39022 жыл бұрын
8:28 you can also use a simple method replace instead of setting the char .
@anikaitdash65192 ай бұрын
I am currently doing a marathon of Java & DSA Course playlist.
@Aimbolino5722 ай бұрын
How're you learning DSA in java?
@anikaitdash651913 күн бұрын
@@Aimbolino572 From this channel and other channels.
I do this question in my style import java.util.*; public class learning{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); String name = "Hello"; int i = name.length(); while(i > 0){ i = i -1; System.out.print(name.charAt(i)); } } }
@dyvikmanju62557 ай бұрын
i used this logic 🙄 StringBuilder st=new StringBuilder("helllllo"); for (int i=st.length()-1;i>=0;i--) { System.out.println(st.charAt(i)); } ik its gonna print line by line... but logic seems comfortable
@Experiencedthroughlife6 ай бұрын
Don't use println instead use print which print it in a single line
@shatayuakare44932 жыл бұрын
For reverce String this short cut method public static String ReverceString(String str){ for (int i=str.length()-1; i>=0; i--){ System.out.print(str.charAt(i)); } return str; }
@KishorDhobale-q8e4 ай бұрын
Only use reverse(); method for reverse string sb.reverse()
@Pegoutamsaini Жыл бұрын
Reverse code can be done like: StringBuilder sb = new StringBuilder("Pegoutam"); sb.reverse(); System.out.println(sb); } }
@ashitoshbankar40523 жыл бұрын
just one suggestion in futre videos for any series please use one editor makes so much confusion between vs and intellij shortcuts
@rishabhmaurya73273 жыл бұрын
We can reverse String without StringBuilder. But we have to make a new String. import java.util.*; public class ReverseString { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String newStr = ""; for(int i=str.length()-1; i>=0; i--){ newStr += str.charAt(i); } System.out.println(newStr); } }
@riponislam6164 Жыл бұрын
Sahi hain
@shaikasad-yn8he2 ай бұрын
bhai a length()-1 ka kya matlab hai explain plz
@HEXABONG2 жыл бұрын
Also reverse a string by this way: String palindrome = "Hello World" , reverseStr = ""; int strLength = palindrome.length(); for(int i = strLength-1; i>=0; i--){ reverseStr = reverseStr + palindrome.charAt(i); } System.out.println(reverseStr);
@barsharanipati65753 жыл бұрын
Amazing😍. Love from Odisha ❤
@apurvakoduganti20413 жыл бұрын
Same !
@soumyaranjangumansingh90803 жыл бұрын
Same...but JEE dropper
@rameshmalhotra95253 жыл бұрын
kzbin.info/www/bejne/l6jLp4N6lMiXiNk
@kuldeepsahoo4680 Жыл бұрын
Wow same but in 2023
@imransindhi7318 Жыл бұрын
Aslam o Alikum i am from pakistan apke video se main boht kujh sekh rah ho i love sis agr main sucesses hogya to apse milne zoror aoga, I love sis Allah Apko Khush rakhi or Aman Bhai ko😍🥰
@technikalproblem6780 Жыл бұрын
Thanks a lot for creating this video!
@Aspirant65.2 ай бұрын
Happy teachers day shradhha di😊❤
@harshthakur98903 жыл бұрын
Thank you so much for providing best content.
@11ajayalaxmimudaliar275 ай бұрын
public static void main(String args[]) { StringBuilder str = new StringBuilder("hello"); for (int i = (str.length() - 1); i >= 0; i--) { System.out.print(str.charAt(i)); } str.reverse(); System.out.print(str); } more easy and simple code in single line
@autodocofficial21613 жыл бұрын
Really thnks alot dii...Really means a lot ...wait for last 2 days ki kab aayagi apki video 😁....but np aap ka kaam bhi simple nhii hai..to explain in such a simplified way...🤗
@nazeershaik98122 жыл бұрын
REVERSE STRING USING STRING BUILDER :: public class reverseStringBuilder { public static void main(String[] args) { StringBuilder sb = new StringBuilder("Hell"); for (int i = 0; i
@youtubers_united2 жыл бұрын
Didi I used a for loop for whole length for reversing and the method which you gave. the time complexity did not reduce by half. first one was 3s 454 ms and second one was 3s 745 ms
@brainworkout3799 Жыл бұрын
loop alone will not determine time complexity, many common things such as creation of string and initialization of variables were common
@ShaikShaikshavali-e9y Жыл бұрын
Use reverse() of StringBuilder's method for reverse a String
@Amanxtcode Жыл бұрын
uh... bechara Tony badal ke Pony ho gaya😁
@dibyanshusingh242311 ай бұрын
18:30 agar humare pass yahan Aman hota ❤❤😂😂
@kalyanansuri Жыл бұрын
To reverse string : For loop lenght-1 se lekar 0 tak chalake, charAT(i) ko print karliya tho hojayega
@Shawonmondal Жыл бұрын
Reverse String import java.util.Scanner; public class flip { public static void main(String[] args) { String b = "Aman"; for(int i=0; i
@divyanshsharma85405 ай бұрын
Scanner sc = new Scanner(System.in); String a= sc.nextLine(); String k = " "; for(int i =0;i
@darshanpagar18942 жыл бұрын
In c++ for(int i = 0; i < s.size()/2; i++) { swap(s[i],s[s.size() - 1 - i]); }
@manojverma2452 жыл бұрын
public class Main { public static void main(String[] args) { String name = "Manoj"; String rev = " "; for(int i=name.length()-1;i>=0;i--){ rev = rev+name.charAt(i); } System.out.println(rev); } }
@dikshantakumarbharadwaj60522 жыл бұрын
we can make changes in String without using StringBuilder Try this: String a ="Elon"; String name = a.replace("E","M"); System.out.println(name);
@sadabalam83162 жыл бұрын
Mlon
@ramaplayz6934 Жыл бұрын
StringBuilder opposite=new StringBuilder(hello); opposite.reverse(); System.out.println(opposite); mam ye bhi to thik hai
@Anonymous-ue1wp3 жыл бұрын
jaldi jaldi dalo can't wait
@ompatel7410 Жыл бұрын
public void reverseString(char[] s) { int start = 0; int end = s.length - 1; while(start < end){ char tmp = s[start]; s[start] = s[end]; s[end] = tmp; start++; end--; } }
@VinayakSharma00776 ай бұрын
8:50 to anyone facing error during this code which looks like this: java: incompatible types: java.lang.String cannot be converted to char then just change the character to 'P' from "P" in the setCharAt function.. I am also new to java and i think apparently java considers " " to be Strings and ' ' to be Character (Char)..
@sehajbrar98152 жыл бұрын
you are brilliant tnk u so much
@tobateksingh49333 жыл бұрын
Great Upload video of python programming language.
@MrDoggo-nd1jv2 жыл бұрын
12:05 Meanwhile Marvel : 🤝🫂
@RahulTiwari-be1xx2 жыл бұрын
This logic will only work with the string "hello"
@mohitdodiya3989 Жыл бұрын
we can use this code for revers String .. public static void main(String[] args) { StringBuilder sb = new StringBuilder("MOhitDodiya"); StringBuilder sb2 = new StringBuilder(""); for(int i=sb.length()-1;i>=0;i--){ sb2.append(sb.charAt(i)); } System.out.println(sb2); }
@naturelove642511 ай бұрын
15:09 she already gave us a hint about aman bhaiya 😅 18:31 once again
@varunk.162 жыл бұрын
Are hum ya pe reverse for loop bhi to use kr skte hai..... String name = "Varun"; for(int i = name.length()-1; i>=0; i--){ System.out.print( name.charAt( i ) ) ; } //Output == nuraV 👍👍👍
@athardoi91612 жыл бұрын
This also one of Solution to make String reverse & time complexity will remain same O(n) String name = "athar"; String result = ""; for(int i=name.length()-1; i>=0; i--){ result = result + name.charAt(i); }
@Babu-lt4vt2 жыл бұрын
StringBuilder sb= new StringBuilder("hello"); for (int i=sb.length()-1;i>=0;i--) { System.out.print(sb.charAt(i)); } }