PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/TikTok

Check if two-group seating is possible

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of graph theory concepts—particularly bipartiteness and graph traversal—and competency in algorithm design and implementation within the Coding & Algorithms domain, emphasizing practical application of traversal-based reasoning rather than purely conceptual theory.

  • Medium
  • TikTok
  • Coding & Algorithms
  • Software Engineer

Check if two-group seating is possible

Company: TikTok

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given an undirected graph represented as an adjacency list where adj[i] lists the indices of guests who know guest i, determine whether all guests can be seated using at most two groups such that no two guests in the same group know each other. Return true if such a seating is possible, otherwise false. Describe and implement an algorithm that handles disconnected components, and analyze time and space complexity. State assumptions about bidirectionality of edges, presence of self-loops or duplicate entries, and outline edge cases and tests.

Quick Answer: This question evaluates understanding of graph theory concepts—particularly bipartiteness and graph traversal—and competency in algorithm design and implementation within the Coding & Algorithms domain, emphasizing practical application of traversal-based reasoning rather than purely conceptual theory.

Related Interview Questions

  • Parse a nested list from a string - TikTok (medium)
  • Implement stacks, streaming median, and upward path sum - TikTok (easy)
  • Maximize sum with no adjacent elements - TikTok (medium)
  • Implement stack variants and path-sum check - TikTok (medium)
  • Find the longest palindromic substring - TikTok (easy)
TikTok logo
TikTok
Jul 15, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

Given an undirected graph represented as an adjacency list where adj[i] lists the indices of guests who know guest i, determine whether all guests can be seated using at most two groups such that no two guests in the same group know each other. Return true if such a seating is possible, otherwise false. Describe and implement an algorithm that handles disconnected components, and analyze time and space complexity. State assumptions about bidirectionality of edges, presence of self-loops or duplicate entries, and outline edge cases and tests.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More TikTok•More Software Engineer•TikTok Software Engineer•TikTok 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.