Search⌘ K
AI Features

Quiz: Algorithm Analysis

Test your understanding of algorithm analysis in coding interviews.

We'll cover the following...
Technical Quiz
1.

What is the time complexity of the following code?

public static int FindMax(int[] arr)
{
    int maxVal = arr[0];
    foreach (int num in arr)
    {
        if (num > maxVal)
        {
            maxVal = num;
        }
    }
    return maxVal;
}
A.

O(1)O(1)

B.

O(logn)O(\log n)

C.

O(n)O(n)

D.

O(n2)O(n^2)


1 / 5