in coding round they ask some complicated question like,. Reverse a string that reverse their character but do not change their position e.g- HELLO WORLD - OLLEH DLROW
Anonymous
int spc; int count=0; void revString() { String s1="HELLO WORLD IS"; char[] c=s1.toCharArray(); for(int i=0;i=0;j--) { System.out.print(c[j]+""); } System.out.print(" "); spc=i;//5 count++;//1 } else if(c[i]==' '&&count!=0) { for(int j=i-1;j>spc;j--)//i=11 & spc=5 { System.out.print(c[j]+""); } System.out.print(" "); spc=i; count++; } else if(i==s1.length()-1) { for(int j=s1.length()-1;j>spc;j--) { System.out.print(c[j]+""); } } }
Check out your Company Bowl for anonymous work chats.