We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
help,my c# solution only has 19/23 test failed .Does it has anything to do with using List?
public static int anotherMinimaxProblem(List a)
{
int max = int.MaxValue;
for (int i = 0; i < a.Count; i++)
{
int maxima = 0;
for (int j = 0; j < a.Count; j++)
{
if (i == j)
{
continue;
}
int answer = a[i] ^ a[j];
if (answer > maxima)
{
maxima = answer;
}
}
if (maxima < max)
{
max = maxima;
}
}
return max;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Yet Another Minimax Problem
You are viewing a single comment's thread. Return to all comments →
help,my c# solution only has 19/23 test failed .Does it has anything to do with using List?
public static int anotherMinimaxProblem(List a) { int max = int.MaxValue; for (int i = 0; i < a.Count; i++) {
}