thoughtspot logo
Thoughtspot· MTS2,3

ThoughSpot Interview Experience/Question - MTS2,3

Posted
8 May 2026
341 reads

Summary

Interviewee was asked to write a C++ program to determine service deployment order based on dependencies, ensuring no cycles and proper batching.

How it went

Hi everyone! I recently interviewed with the ThoughtSpot Orion Team and wanted to share a specific question I was asked. The team emphasized that this problem is very representative of their daily work on the orchestration layer. If you’re preparing for a role with them, I highly recommend practicing this one.

The Question:
You are given a root directory called:

/services

Inside this directory, each subdirectory represents a service.

Example:

/services
    /Auth
        config.txt
    /Billing
        config.txt
    /User
        config.txt
    /Database
        config.txt

📄 Config File Format

Each service contains a file config.txt.

The file contains exactly one line in this format:

depends=ServiceA,ServiceB,ServiceC

If there are no dependencies:

depends=

🎯 Requirements

Write a C++ program that:

  • Scans all service folders inside /services.
  • Parses each config.txt.
  • Determines the correct deployment order.
  • Ensures:
    • A service is deployed only after all services listed in its depends line are deployed.
    • Services that have no remaining unmet dependencies can be deployed in parallel.
  • Outputs deployment batches.
  • Detects cyclic dependencies and prints:
Error: Cycle detected. Deployment not possible.

✅ Example

Folder Structure

Auth     → depends=Database
Billing  → depends=Auth
User     → depends=Auth
Database → depends=

Expected Output

Batch 1: Database
Batch 2: Auth
Batch 3: Billing User

Questions asked (1)

  1. 01

    Service Deployment Order Based on Dependencies

    Data Structures & Algorithms · Hard

    You are given a root directory called /services. Inside this directory, each subdirectory represents a service. Each service contains a file config.txt, which lists its dependencies in the format:

    depends=ServiceA,ServiceB,ServiceC

    If there are no dependencies, the file will contain just:

    depends=

    Your task is to write a C++ program that:

    • Scans all service folders inside /services.
    • Parses each config.txt.
    • Determines the correct deployment order such that a service is deployed only after all its dependencies are deployed.
    • Groups services that can be deployed in parallel into batches.
    • Detects cyclic dependencies and returns an error message if any cycle exists.

    Example Folder Structure:

    Auth     → depends=Database
    Billing  → depends=Auth
    User     → depends=Auth
    Database → depends=

    Expected Output:

    Batch 1: Database
    Batch 2: Auth
    Batch 3: Billing User

    In case of a cycle, output:

    Error: Cycle detected. Deployment not possible.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Thoughtspot recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!