Quick Overview

Determine whether every component of an undirected graph can be colored with two colors so adjacent nodes differ. The problem tests linear-time graph traversal, disconnected and isolated nodes, conflict detection, parallel edges, self-loops, and correctness on large sparse inputs.

Determine Whether an Undirected Graph Is Two-Colorable

Company: Apple

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Determine whether every component of an undirected graph can be colored with two colors so adjacent nodes differ. The problem tests linear-time graph traversal, disconnected and isolated nodes, conflict detection, parallel edges, self-loops, and correctness on large sparse inputs.

Read the full Apple Software Engineer interview experience this question came from

Loading…