SachinK
BAN USERfunction addArray(nums1,nums2) {
var nums3 =[];
var i =0,j=0;
while(true){
var op1 = 0,op2 =0 ;
var arr1Done = false,arr2Done = false;
if (i<nums1.length ) {
op1 = nums1[i++];
}else{
arr1Done = true;
}
if (j<nums2.length) {
op2 = nums2[j++];
}else{
arr2Done = true;
}
if(arr1Done == true && arr2Done == true){
break;
}else{
var res = op1+op2;
if (res>10) {
res = res+'';
nums3.push(parseInt(res.split('')[0]));
nums3.push(parseInt(res.split('')[1]));
}else{
nums3.push(res);
}
}
}
return nums3;
}
- SachinK April 08, 2016public static int findLargestPalindrome(String text){
String[] strings = text.split(" ");
int largest = 0;
for (int i = 0; i < strings.length; i++) {
if (isPalindrome(strings[i])) {
if (largest<strings[i].length()) {
largest = strings[i].length();
}
}
}
return largest;
}
public static boolean isPalindrome(String s){
int i=0,j=s.length()-1;
boolean isPalindrome = true;
while (i<j) {
if (s.charAt(i) != s.charAt(j)) {
isPalindrome = false;
break;
}
i++;j--;
}
return isPalindrome;
}
def revWordsInAString(str):
- SachinK April 16, 2018words = str.split(' ')
newstr = ''
for c in range(len(words)-1,-1,-1):
temp = list(words[c])[::-1]
for i in temp:
newstr+= i
print(newstr)