Комментарии:
JAVA
public class LastWordLength {
public static void main(String[] args) {
String str = "i am a good student";
int count = 0;
int len = str.length() -1;
for (int i = len ; i > 0 ; i--) {
if (str.charAt(i) == ' '){
break;
}else {
count++;
}
}
System.out.println(count);
}
}
If one do it by using inbuilt functions. ,. Then it is allowed to use inbuilt functions in these type of coding exams like TCS, WIPRO, COGNIZABT, IBM, ACCENTURE, INFOSYS, CAPEGMINI.?
ОтветитьProvide provide the code that run on this type of input " I am the beast not you". Answer would be 5
ОтветитьIf string is "you have more power than me" then is this code give correct result 5 or not
ОтветитьHey I got selected for Cognizant GenC Elevate. I would like to share my experience with others. Please do reply 🙂
Ответить