No, Kadane's algorithm considers subarray sum, we are considering
concatenation ( for whole array ).
The solution with custom string comparator : http://ideone.com/doASH.
On May 27, 9:15 pm, Supraja Jayakumar suprajasank...@gmail.com
wrote:
Hi
Isnt this the Kadane's (largest subarray) problem
Any prime number greater than 3 is congruent to 1 or 5 mod 6.
a is a prime number = a % 6 == 1 or a % 6 == 5
a*a + 26 != prime for a = 2,3
for a 3:
if a % 6 == 1:
(a*a)%6 == 1 and 26 % 6 = 2 = ( a*a + 26 ) % 6 = 3 = not prime
if a % 6 == 5:
(a*a)%6 == (a%6)*(a%6)%6 = (5*5)%6 = 1 = ( a*a +