Snowflake SWE (AI/ML) intern OA
Summary
I completed an online assessment for a software engineering AI/ML intern position, which included three distinct coding and statistical problems.
Full Experience
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.
Problem 1: Simple Array Rotation Game
Description: You are given an array of distinct positive integers and another array that specifies the number of left circular rotations to be performed.
Rotation Rule A left circular rotation shifts all elements one position to the left: the element at index `0` moves to the last position; all other elements shift left by one index.
Task For each rotation value in the `rotate` array: perform the rotation on the **original array** (not cumulatively) and determine the **index of the maximum element** after the rotation.
Function Description Complete the function `getMaxElementIndexes`.
Parameters: `int a[n]`: Array of distinct integers. `int rotate[m]`: Array representing the number of rotations.
Returns: `int[m]`: Array where each element represents the index of the maximum element after corresponding rotations.
Constraints 1 ≤ n, m ≤ 100000; 1 ≤ a[i] ≤ 1000000000; 0 ≤ rotate[i] ≤ 1000000000
Example 1 Input: a = [1, 2, 3]; rotate = [1, 2, 3, 4] Output: [1, 0, 2, 1]
Problem 2: String Formation
Description: You are given an array of strings where each string has the same length, and a target string.
Rules for Formation You can pick characters from any string. The indices of chosen characters must be strictly increasing. You can use multiple characters from the same string. Different choices of indices or strings count as different ways.
Task Determine the total number of ways to form the target string. Return the result modulo 10^9 + 7.
Function Description Complete the function `numWays`.
Parameters: `string words[n]`: Array of strings of equal length. `string target`: Target string to form.
Returns: `int`: Number of ways to form the target string modulo (10^9 + 7)
Constraints 1 ≤ n ≤ 1000; 1 ≤ length of words[i] ≤ 3000; Sum of length of all words ≤ 100000; 1 ≤ length of target ≤ length of words[i]
Example Input: words = ["adc", "aec", "efg"]; target = "ac" Output: 4 (four valid ways listed in the post)
Problem 3: Test the Hypothesis
Description: You are given two datasets and a confidence level. Your task is to determine whether their means are significantly different using a t‑test.
Hypothesis Testing Perform a two‑tailed t‑test. Compare the computed t‑statistic with the critical t‑value at the given confidence level.
Output Requirements Return: 1) "Yes" if means are significantly different, otherwise "No". 2) A magnitude value defined as |t_computed ‑ t_critical|, rounded to 2 decimal places.
Function Description Complete the function `testHypothesis`.
Parameters: `int n`: Number of data points; `float x[n]`: First dataset; `float y[n]`: Second dataset; `float confidence_level`: Confidence level.
Returns: `array[2]`: First element "Yes" or "No", second element magnitude.
Example Input: x = [4.461, 7.757, 17.317, 4.151]; y = [8.911, 12.68, -10.593, 17.048]; confidence_level = 0.95 Output: ["No", 2.47]
Interview Questions (3)
Simple Array Rotation Game
You are given an array of distinct positive integers and another array that specifies the number of left circular rotations to be performed. For each rotation value, perform the rotation on the original array (not cumulatively) and determine the index of the maximum element after the rotation.
Function: `getMaxElementIndexes(int a[n], int rotate[m])` returns an array of indices.
Constraints: 1 ≤ n,m ≤ 100000; 1 ≤ a[i] ≤ 10⁹; 0 ≤ rotate[i] ≤ 10⁹.
String Formation
Given an array of equal‑length strings and a target string, count the number of ways to form the target by picking characters from any strings such that the chosen indices are strictly increasing. Different choices of indices or source strings count as distinct ways. Return the count modulo 10⁹ + 7.
Function: `numWays(string words[n], string target)` returns an integer.
Test the Hypothesis
Given two numeric datasets and a confidence level, perform a two‑tailed t‑test to decide whether the means are significantly different. Return "Yes" if they are, otherwise "No", along with the magnitude |t_computed ‑ t_critical| rounded to two decimals.
Function: `testHypothesis(int n, float x[n], float y[n], float confidence_level)` returns an array [string, float].