← Snowflake Interview Insights

Snowflake·Software Engineer·Online Assessment (OA)·Junior

JuniorPending
May 2026Remote

Summary

Took the Snowflake AIML Intern HackerRank OA after two weeks of frantic prep and genuinely low confidence in my DSA skills. Two questions, easier than I feared, though the platform itself caused some unnecessary stress.

Questions Asked (2)

Q1

Given an array of integers, you can perform up to k operations where each operation doubles any single element. Return the maximum possible bitwise OR of all elements after applying the operations.

Algorithms & Data Structures
Author's notes

The key insight is that doubling is just a left shift, and to maximize OR you want to concentrate all k doublings on the largest element.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and edge cases. Then, explain that to maximize the bitwise OR, we should focus on setting the highest possible bits, which can be achieved by doubling the element with the highest potential to set new bits. Use a greedy strategy: repeatedly double the element that yields the greatest increase in the OR value, up to k times.

Pro tip: Mention that the greedy choice is optimal because doubling an element shifts its bits left, and setting a higher bit always dominates any combination of lower bits. Also, note that the operations are independent and can be applied to the same element multiple times.

1. Understand the problem

Restate the problem in your own words: we have an array, can double any element up to k times, and want to maximize the bitwise OR of all elements. Clarify that operations can be applied to the same element multiple times.

2. Identify the goal

The bitwise OR is maximized by setting the highest possible bits. Since doubling shifts bits left, we want to use operations to set the most significant bits possible.

3. Devise a greedy strategy

At each step, double the element that results in the largest increase in the OR value. This can be done by simulating the process or by analyzing the binary representation of the numbers.

4. Prove optimality

Argue that the greedy choice is optimal: setting a higher bit always increases the OR more than any combination of lower bits. Therefore, focusing on the highest bits is always beneficial.

5. Analyze complexity and edge cases

Discuss time complexity (e.g., O(k * n) for naive simulation, or more efficient with priority queue) and handle edge cases like k=0, all zeros, or negative numbers (if allowed).

Key Points to Mention

  • Bitwise OR properties: OR is monotonic, and higher bits dominate lower bits.
  • Doubling an element is equivalent to left-shifting its binary representation by 1.
  • Greedy approach: always double the element that currently has the highest bit not yet set in the OR, or that yields the maximum new OR.
  • Use a max-heap or priority queue to efficiently select the element to double at each step.
  • Time complexity: O(k log n) with a heap, or O(k * n) with linear scan.
  • Edge cases: k=0, array with all zeros, large k relative to bit length, and potential overflow (use long or big integers).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Implement a Student class and a Result class that inherits from it. Result should store marks for three subjects, compute a percentage, and handle recheck requests. Pass mark is 33.33%.

Algorithms & Data StructuresSystem Design
Author's notes

The OOP logic itself was not hard at all.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then design a clean class hierarchy with Student as a base class and Result as a derived class. Implement methods for marks entry, percentage calculation, and recheck handling, ensuring proper validation and encapsulation. Test with boundary cases like exactly 33.33% and invalid inputs.

Pro tip: Demonstrate production-level thinking by discussing how you'd extend this to handle multiple semesters, different grading schemes, or concurrency, and mention that you'd use composition over inheritance if the relationship isn't strictly 'is-a'.

1. Clarify requirements and edge cases

Ask about input validation, recheck process (e.g., re-evaluation of marks, fee, status tracking), and whether Result should inherit from Student or contain one. Confirm pass mark logic and rounding.

2. Design class hierarchy and interfaces

Define Student with basic attributes (name, id) and methods. Make Result inherit from Student, adding marks array, percentage calculation, and recheck methods. Consider using an interface for recheckable entities.

3. Implement core methods with validation

Write constructors, getters/setters with validation (marks between 0-100), calculatePercentage() that returns a double, and isPassed() checking against 33.33%. Implement requestRecheck() to update status and possibly recalculate.

4. Handle recheck workflow and state

Model recheck as a state transition (e.g., PENDING, APPROVED, REJECTED). Allow marks update upon approval and recalculate percentage. Discuss how to persist or log recheck requests.

5. Test and discuss extensibility

Write unit tests for boundary cases (exactly 33.33%, zero marks, invalid inputs). Discuss how to extend for more subjects, different grading systems, or integration with external systems.

Key Points to Mention

  • Encapsulation: private fields with public getters/setters and validation
  • Inheritance vs composition: justify why Result inherits from Student (or not) and potential issues
  • Percentage calculation: sum marks / total marks * 100, handle division by zero
  • Pass mark logic: use >= 33.33 with proper floating-point comparison (epsilon)
  • Recheck handling: state management, audit trail, and asynchronous processing
  • Edge cases: invalid marks, missing subjects, recheck after pass/fail, concurrency

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.