sachin.sde
BAN USER
Friends,
Jie's solution can be modified to provide O(N) time complexity.
1. Each Hash table element can store Pair of 'sum' and 'list of indexes' to array of elements. Each list will have array indexes with equal sum.
3. Maintain another 'master list' of 'list of indexes with more than one item' separately. This list will be used to print sub sequences.
right : 0+
acute : 0.25-
obtuse : 0.75-
Semicircle formed by first two points can cover min 50% to max 100% of the points on the circle based on their position on the circle. But never less than 50%. On an average 75%. Third point can be any point on the circle, it means third point will be on the semicircle for about 75% times.
I agreed! :) Modified comments accordingly.
- sachin.sde November 22, 2013// C Version - Recursive approach.
bool isKPalindrom(char * str, int len, int k)
{
while (len >=1 && str[0] == str[len-1])
{
str++; len-=2;
}
if (len <= 1) return true;
if (k > 0)
return isKPalindrom(str + 1, len-1, k-1) || isKPalindrom(str, len-1, k-1);
return false;
}
RepLizzieGibson, Cloud Support Associate at Aspire Systems
I'm an engineering student from Huntsville, AL USA. Have more interest in management and stuff related to business. Promptly ...
Repanitajrouse, Kuwait airways reservations at American Airlines
I am Anita from Hastings USA. I am working as a manager in Sofa Express company. I Managed the schedules ...
Longest common sub-string of strings S1, S2,.... Sn can be found as follows:
- sachin.sde November 25, 20131. Build a generalized suffix tree for S1, S2,... Sn
2. Mark each internal node v by 1 (resp. 2, ... n) if the subtree below v contains a leaf for a suffix of S1 (resp. S2,... Sn)
3. Traverse the tree to find nodes marked by all 1, 2,...n and choose any u of them with a maximal string-depth
4. L(u) is a maximal common sub-string