tunguyen161088
BAN USERpublic bool checkInterleave(string a, string b, string c)
{
if (a.Length + b.Length != c.Length)
return false;
int cA = 0, cB = 0, cC = 0;
while (cC < c.Length)
{
if (cA<a.Length && cB<b.Length && a[cA] == b[cB])
return checkInterleave(a.Substring(cA + 1, a.Length - cA - 1), b.Substring(cB, b.Length - cB), c.Substring(cC + 1, c.Length - cC - 1)) || checkInterleave(a.Substring(cA, a.Length - cA), b.Substring(cB + 1, b.Length - cB - 1), c.Substring(cC + 1, c.Length - cC - 1));
else if (cA < a.Length && a[cA] == c[cC])
{
cA++;
}
else if (cB < b.Length && (b[cB] == c[cC]))
{
cB++;
}
else return false;
cC++;
}
if (cA == a.Length && cB == b.Length && cC == c.Length)
return true;
else return false;
}
- tunguyen161088 March 30, 2014throw 5 times, sum up the value of each time and get the remainder of sum % 7.
- tunguyen161088 March 30, 2014public void NegPostSort(int[] a, int low)
{
int neg = -1;
int pos = -1;
int current = low;
while ((current < a.Length) && ((neg < 0) || (pos < 0)))
{
if (a[current] > 0 && pos < 0)
pos = current;
if (a[current] < 0 && neg < 0)
neg = current;
current++;
}
while (neg > pos)
{
swap(ref a[neg], ref a[--neg]);
}
if (++neg < a.Length && current < a.Length)
NegPostSort(a, neg);
}
private void swap(ref int a, ref int b)
{
int t = a;
a = b;
b = t;
}
- tunguyen161088 March 30, 2014public void NegPostSort(int[] a, int low)
{
int neg = -1;
int pos = -1;
int current = low;
while ((current < a.Length) && ((neg < 0) || (pos < 0)))
{
if (a[current] > 0 && pos < 0)
pos = current;
if (a[current] < 0 && neg < 0)
neg = current;
current++;
}
while (neg > pos)
{
swap(ref a[neg], ref a[--neg]);
}
if (++neg < a.Length && current < a.Length)
NegPostSort(a, neg);
}
private void swap(ref int a, ref int b)
{
int t = a;
a = b;
b = t;
}
- tunguyen161088 March 30, 2014
Repjoanarce252, abc at ABC TECH SUPPORT
Hello, I am Joan. I live in Jackson, USA. I am passionate about my work and I am working as ...
}
- tunguyen161088 March 30, 2014