Snowflake

Online Assessment

SnowflakeOnline Assessment

Company-style OA practice sets with full problem statements, sample test cases, and solutions.

5 Sets2 Questions/Set90 minHash TableStringSliding WindowArrayDepth-First Search

💰 Contribute & Earn

Have you recently taken Snowflake's Online Assessment or coding test? Share the questions, test cases, or assessment patterns you encountered. Earn SWE180 Coins for every verified submission and use them to unlock other company OA sets and premium tools for free!

Share OA & Earn Coins ➔

Practice Sets

Snowflake Early Career & Campus OA — Set 1

90 min2 questions
Q1.
Distinct Score Values
Dynamic ProgrammingBit ManipulationFenwick TreeSubsequences
Medium-Hard

Problem Statement

A coding competition organized to recruit software developers includes an operation.

The score of a sequence is defined as the result of the bitwise-OR operation on all elements of the sequence.

Given an array arr of length n, identify all possible distinct scores that can be obtained from any strictly increasing subsequence from the array. Return the results sorted in ascending order.

Note:

• An empty subsequence is valid and yields a score of 0.

• A subsequence is strictly increasing if each element is strictly greater than the preceding element.

Input Format

  • The first line contains an integer n, the number of elements in arr.
  • The next n lines each contain an integer denoting arr[i].

Output Format

  • Print all distinct score values sorted in ascending order, each on a new line (or return an array of integers sorted in ascending order).

Constraints

  • 1 <= n <= 10^4
  • 1 <= arr[i] < 1024

Sample Test Cases

Example 1

Input

4
4
2
4
1

Output

0
1
2
4
6

Explanation

Strictly increasing subsequences:

• Empty subsequence: score = 0

• [1]: score = 1

• [2]: score = 2

• [4]: score = 4

• [2, 4]: score = 2 | 4 = 6

Sorted distinct scores: [0, 1, 2, 4, 6].

Example 2

Input

4
3
2
4
6

Output

0
2
3
4
6
7

Explanation

Strictly increasing subsequences include empty (0), [2] (2), [3] (3), [4] (4), [6] (6), [2,4] (6), [3,4] (7), [3,6] (7), [3,4,6] (7), etc. Distinct scores: [0, 2, 3, 4, 6, 7].

Time:O(N * log(MAX_V) * (MAX_S / 64)) using Bitset Fenwick Tree
Space:O(MAX_V * MAX_S / 64) auxiliary space
Approach:Maintain reachable bitwise-OR scores for subsequences ending at each element value. Use a Binary Indexed Tree (Fenwick tree) over values 1..1024 to query the union of all reachable scores ending at elements smaller than arr[i] in O(log M) time.
Q2.
Python: Documentation Generator
Python IntrospectionInspect ModuleType AnnotationsCallables
Medium

Problem Statement

Implement the get_doc(fun: Callable) -> str function that automatically generates documentation for a given function.

The input function fun has the following characteristics:

• It has 0 or more positional parameters.

• Its parameters have type annotations of either int or str.

• Its return type has a type annotation of either int or str.

The returned documentation string must follow this format:

function name

<name_of_fun>

params (<num_of_params>)

<param_1_name> <param_1_type_annotation>

<param_2_name> <param_2_type_annotation>

...

return type

<return_type_annotation>

example usage

<name_of_fun>(<param_1_example>, <param_2_example>, ...) -> <return_value_of_calling_fun_with_given_arguments>

Rules for example values:

• int parameters are consecutive positive integers starting from 2 (2, 3, 4, ...).

• str parameters are consecutive lowercase English letters starting from 'a' ('a', 'b', 'c', ...).

Input Format

  • A Python Callable `fun` with positional parameters annotated with int or str and return type annotated with int or str.

Output Format

  • A single formatted multiline string matching the documentation template.

Constraints

  • Number of parameters >= 0
  • Parameter annotations in {int, str}
  • Return type annotation in {int, str}

Sample Test Cases

Example 1

Input

def increment(x: int) -> int:
    return x + 1

Output

function name
  increment
params (1)
  x int
return type
  int
example usage
  increment(2) -> 3

Explanation

Function name is increment, has 1 int parameter x, return type is int. The int parameter starts with 2, giving increment(2) -> 3.

Example 2

Input

def repeat_word(word: str, count: int) -> str:
    return word * count

Output

function name
  repeat_word
params (2)
  word str
  count int
return type
  str
example usage
  repeat_word('a', 2) -> aa

Explanation

word receives 'a' and count receives 2. Calling repeat_word('a', 2) evaluates to 'aa'.

Time:O(P) where P is the number of parameters
Space:O(P) auxiliary space for constructing the output lines
Approach:Use Python's inspect.signature(fun) to extract parameter names and annotations. Maintain counters for consecutive integer and string arguments, invoke fun(*args) to compute the example output, and join lines with 2-space indentation.

Comprehensive Snowflake Online Assessment Patterns & Questions

Gain complete transparency into the Snowflake online assessment process. Prepare effectively with real, verified coding challenges, test patterns, and platform details.

Snowflake Exact Coding Questions

Wondering what top companies are actually asking in their initial screening rounds? We provide exact Data Structures, Algorithms, and logical reasoning questions reported by candidates who recently took the Snowflake online tests. Stop guessing and start practicing the right problems.

Test Patterns & Platforms

Understand exactly how many questions to expect, the typical time limits, and the platforms used (e.g., HackerRank, Codility, CodeSignal). Knowing the format in advance is the first step to clearing the Snowflake OA.

🔥 Why practice these assessments?

  • ✓High ROI: Most candidates are filtered out at the OA stage. Passing the OA guarantees an interview.
  • ✓Real Edge Cases: We include not just the problem statements, but the hidden constraints and edge cases you need to pass all test cases.
  • ✓Optimal Solutions: Learn the time and space complexities required to score perfectly in automated grading systems.