kartikkhatri01
BAN USERWill this work if substrings stize is not specified... it seems to be hardcoded to 2.
- kartikkhatri01 June 09, 2014will it work for - (a+(b)) -
- kartikkhatri01 May 05, 2014if(str_1.length > str_2.length)
str =str_1;
str_othr =str_2
else
str = str_2;
str_othr = str_1
int count =0;
for (i=0; i <str.length; i++)
if(str.charat(i) == str_othr.charat(i-count);
i++;
else
if (count >2) exit;
else count++;
very nyc solution
just 1 doubt ...ans = max (S[n], S[n-1], S[n-2]);
can u provide the test case where S[n-2] ll get selected
Thanks,
begginer ..cldnt think bettr den dis :o
sort the array (NlogN)
Start from the end ... pick 1 .. check for avalabilty of the next element from the end . nd so on
Now Start for 2nd last element check for avalabilty of the next element from it. nd so on..
can you please email me at kartikkhatri01@gmail.com
- kartikkhatri01 April 09, 2014
---all the cases except will be covered in while loop ..except when the repeated number is in alternative position...
- kartikkhatri01 August 03, 2014while (i<n)
{
if (a[i] =a[i+1])
return a[i];
}
---will cover the case when array will be like ...121314... or 213141...
if(a[0] == a[2])
return a[0];
else
return a[1];