ElaKiri Community
Downloads
Go Back   ElaKiri Community > General > Jobs & Employment
Reload this Page Programming interview - written tests
Reply
 
Thread Tools
(#61)
Old
Anonymous_Abstract Anonymous_Abstract is offline
Senior Member
Anonymous_Abstract is just really niceAnonymous_Abstract is just really niceAnonymous_Abstract is just really niceAnonymous_Abstract is just really niceAnonymous_Abstract is just really niceAnonymous_Abstract is just really niceAnonymous_Abstract is just really niceAnonymous_Abstract is just really nice
 
Posts: 1,713
Join Date: Aug 2018
Location: Messier 87
09-22-2019, 11:57 AM

Quote:
Originally Posted by ArnoDorian View Post
Reverse a given String in java without StringBuffer/Builder..
Intern Technical interview @ Virtusa
public static void main(String[] args) {
TestDemo td = new TestDemo();

String str = "Fuck";
str = td.reverse(str).toString();
System.out.println(str);

}

public StringBuffer reverse(String str) throws ArrayIndexOutOfBoundsException
{

char[] ch = str.toCharArray();//'F','u','c','k'
int len = ch.length;
//char[] ch2=new char[len];
StringBuffer sb = new StringBuffer();
for(int i=len-1;i>=0;i--)
{
sb.append(ch[i]);
}

return sb;
}
Reply With Quote
(#62)
Old
amilabanuka's Avatar
amilabanuka amilabanuka is offline
Senior Member
amilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of lightamilabanuka is a glorious beacon of light
 
Posts: 6,946
Join Date: Sep 2006
Location: Thama math hoyanooo....
Send a message via ICQ to amilabanuka Send a message via Skype™ to amilabanuka
09-22-2019, 01:02 PM

Quote:
Originally Posted by ArnoDorian View Post
Reverse a given String in java without StringBuffer/Builder..
Intern Technical interview @ Virtusa
on top of
Anonymous_Abstract has given,
you can use a stack and traverse the String.
Reply With Quote
(#63)
Old
OrangeHat's Avatar
OrangeHat OrangeHat is offline
Senior Member
OrangeHat has a spectacular aura aboutOrangeHat has a spectacular aura aboutOrangeHat has a spectacular aura aboutOrangeHat has a spectacular aura about
 
Posts: 361
Join Date: Jun 2017
10-01-2019, 04:31 PM

print star pattern
Reply With Quote
Reply

Bookmarks

Tags
interview

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright © 2006 - 2011 ElaKiri™ Beta2.Evo vBulletin, vBa iBproArcade Subdreamer I-Magic MKv

Page generated in 0.02384 seconds with 9 queries