Divide Tree Nodes
Asked at Google · Coding & Leetcode-style Questions · Difficulty: Medium
You are given an undirected tree with **N** nodes. Each node of the tree is assigned to a value. You are required to divide the nodes into as little groups as possible, such that no two nodes in the group are adjacent to each other.
Loading the problem…
More Google interview questions
- LLM conceptual questions
- Implement a Nested Tic-Tac-Toe Game Engine
- ML Fundamentals Deep Dive (AI/ML & MLE Roles)
- ML System Design: Recsys, Chatbot, Image Classifier
- ML Coding: Implement a Simple Attention / Layer Forward Pass
- Longest-Match Greedy Tokenization with Dictionary ID Replacement