Snowflake SWE (AI/ML) intern OA
Anonymous User
289
Mar 31, 2026

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).
  • 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]

Explanation:

  • Rotation 1 → [2, 3, 1], max = 3 at index 1
  • Rotation 2 → [3, 1, 2], max = 3 at index 0
  • Rotation 3 → [1, 2, 3], max = 3 at index 2
  • Rotation 4 → [2, 3, 1], max = 3 at index 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

Example 1

Input:

words = ["adc", "aec", "efg"]
target = "ac"

Output:

4

Explanation:
The 4 valid ways:

  1. Take 'a' from "adc" (index 1), 'c' from "adc" (index 3)
  2. Take 'a' from "adc", 'c' from "aec"
  3. Take 'a' from "aec", 'c' from "adc"
  4. Take 'a' from "aec", 'c' from "aec"

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
  2. "No" → otherwise

Also return a magnitude value, defined as:

magnitude = |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 (rounded to 2 decimals)

Example

Example 1

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]

Explanation:

  • The t-test shows the means are not significantly different.
  • The margin by which the null hypothesis holds is 2.47.
Comments (2)