I recently gave the Snowflake SWE AI/ML Intern OA, and these were the three problems asked. The languages allowed were Go, Java, and Python only.
You are given an array of distinct positive integers and another array that specifies the number of left circular rotations to be performed.
A left circular rotation shifts all elements one position to the left:
0 moves to the last position.For each rotation value in the rotate array:
Complete the function getMaxElementIndexes.
int a[n]: Array of distinct integers.int rotate[m]: Array representing the number of rotations.int[m]: Array where each element represents the index of the maximum element after corresponding rotations.Input:
a = [1, 2, 3]
rotate = [1, 2, 3, 4]Output:
[1, 0, 2, 1]Explanation:
You are given an array of strings where each string has the same length, and a target string.
Determine the total number of ways to form the target string.
Return the result modulo: [10^9 + 7]
Complete the function numWays.
string words[n]: Array of strings of equal length.string target: Target string to form.int: Number of ways to form the target string modulo (10^9 + 7)Input:
words = ["adc", "aec", "efg"]
target = "ac"Output:
4Explanation:
The 4 valid ways:
You are given two datasets and a confidence level. Your task is to determine whether their means are significantly different using a t-test.
Return:
"Yes" → if means are significantly different"No" → otherwiseAlso return a magnitude value, defined as:
magnitude = |t_computed - t_critical|
Complete the function testHypothesis.
int n: Number of data pointsfloat x[n]: First datasetfloat y[n]: Second datasetfloat confidence_level: Confidence levelarray[2]:
"Yes" or "No"Input:
x = [4.461, 7.757, 17.317, 4.151]
y = [8.911, 12.68, -10.593, 17.048]
confidence_level = 0.95Output:
["No", 2.47]Explanation: