PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Snowflake

Solve scheduling and tree path problems

Last updated: Apr 14, 2026

Quick Overview

This set evaluates interval scheduling and constrained optimization for weighted, at-most-K selection, tree structure manipulation and subtree effects on height, and tree pathfinding with parent/child navigation, testing competencies in dynamic programming-like optimization, data structures (trees/binary trees), traversal, and ancestor relationships. These problems are commonly asked in Coding & Algorithms interviews because they probe algorithmic efficiency and correctness under large constraints and require both conceptual understanding of algorithmic trade-offs and practical implementation skills.

  • hard
  • Snowflake
  • Coding & Algorithms
  • Software Engineer

Solve scheduling and tree path problems

Company: Snowflake

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

You are given three separate coding problems (asked across two rounds). For each, write a function that returns the required output. ## Problem 1: Max credits with at most K non-overlapping courses You are given `n` courses. Course `i` has: - start time `s[i]` - end time `e[i]` (assume a course occupies the half-open interval `[s[i], e[i])` so a course ending at time `t` does not conflict with another starting at `t`) - credit value `c[i]` You may take **at most `K` courses**, and you may not take overlapping courses. **Output:** the maximum total credits you can earn. **Inputs:** arrays `s, e, c` and integer `K`. **Constraints (assume typical interview ranges):** `1 ≤ n ≤ 2e5`, `1 ≤ K ≤ n`, times up to `1e9`, credits up to `1e9`. --- ## Problem 2: Height of a rooted tree after deleting a node (subtree removal) You are given a **rooted** binary tree (or general rooted tree—state assumptions in your solution) and a node `x`. Operation: **remove node `x` and its entire subtree** from the tree. **Output:** the height of the remaining tree (define height as number of edges on the longest path from the root to any remaining node; height of an empty tree is `-1` or `0`—state your convention). You may be asked to answer this for one query or for multiple queries. --- ## Problem 3: Directions between two nodes in a binary tree You are given a binary tree and two node values `startValue` and `destValue`. You must output a string describing how to move from the `startValue` node to the `destValue` node using: - `L`: move to left child - `R`: move to right child - `U`: move to parent **Output:** the direction string representing a valid shortest path from start to destination.

Quick Answer: This set evaluates interval scheduling and constrained optimization for weighted, at-most-K selection, tree structure manipulation and subtree effects on height, and tree pathfinding with parent/child navigation, testing competencies in dynamic programming-like optimization, data structures (trees/binary trees), traversal, and ancestor relationships. These problems are commonly asked in Coding & Algorithms interviews because they probe algorithmic efficiency and correctness under large constraints and require both conceptual understanding of algorithmic trade-offs and practical implementation skills.

Related Interview Questions

  • Solve Array Distance and Wiki Navigation - Snowflake (medium)
  • Implement Document Predicate APIs - Snowflake (medium)
  • Find Shortest Wiki Click Path - Snowflake (medium)
  • Schedule prerequisite classes with retakes - Snowflake (easy)
  • Solve three coding rounds - Snowflake (medium)
Snowflake logo
Snowflake
Feb 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
14
0
Loading...

You are given three separate coding problems (asked across two rounds). For each, write a function that returns the required output.

Problem 1: Max credits with at most K non-overlapping courses

You are given n courses. Course i has:

  • start time s[i]
  • end time e[i] (assume a course occupies the half-open interval [s[i], e[i]) so a course ending at time t does not conflict with another starting at t )
  • credit value c[i]

You may take at most K courses, and you may not take overlapping courses.

Output: the maximum total credits you can earn.

Inputs: arrays s, e, c and integer K.

Constraints (assume typical interview ranges): 1 ≤ n ≤ 2e5, 1 ≤ K ≤ n, times up to 1e9, credits up to 1e9.

Problem 2: Height of a rooted tree after deleting a node (subtree removal)

You are given a rooted binary tree (or general rooted tree—state assumptions in your solution) and a node x.

Operation: remove node x and its entire subtree from the tree.

Output: the height of the remaining tree (define height as number of edges on the longest path from the root to any remaining node; height of an empty tree is -1 or 0—state your convention).

You may be asked to answer this for one query or for multiple queries.

Problem 3: Directions between two nodes in a binary tree

You are given a binary tree and two node values startValue and destValue.

You must output a string describing how to move from the startValue node to the destValue node using:

  • L : move to left child
  • R : move to right child
  • U : move to parent

Output: the direction string representing a valid shortest path from start to destination.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snowflake•More Software Engineer•Snowflake Software Engineer•Snowflake Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.