Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Monster Fight

Implement a system to simulate combat between monsters with different attributes and abilities. Design the logic to handle turn-based fighting mechanics and determine the winner.

Asked at:

OpenAI


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Mid April, 2026

OpenAI

Staff

Simulate Turn-Based Monster Team Battle Problem Statement Implement the core battle engine for a turn-based monster team fight between Team A and Team B. Each team has an ordered list of monsters. The battle proceeds in rounds until one side has no living monsters left, and you must produce a detailed, time-ordered battle log. Each monster has: - name (string) - health (HP, integer) - attack (ATK, integer) Active Monster: - For each team, the Active Monster is the first monster in its list with HP > 0. - If a team has no living monsters, it loses immediately. Round flow (fixed): 1) Team A's Active Monster attacks Team B's Active Monster. 2) Team B's Active Monster counterattacks Team A's Active Monster. 3) Next round starts. Damage: - When X attacks Y: Y.HP -= X.ATK Important rule (to match the interview version and allow draws): - The counterattack always happens if Team B had a living Active Monster at the start of the round, even if Team A's attack reduces it to HP <= 0. This is a "dying strike". - A monster that reaches HP <= 0 during the round is removed after the counterattack step finishes. Replacement: - When an Active Monster dies, it is removed and the next living monster (if any) becomes Active for the next round. End conditions: - "Team A wins" if Team B has no living monsters. - "Team B wins" if Team A has no living monsters. - "Draw" if both teams have no living monsters after the same round. Logging requirements (in order): - Each attack: who attacked whom, damage, and defender HP change (before -> after). - Counterattacks that are dying strikes must be marked with "[dying strike]". - Each death event. - Each replacement event ("Team X sends out ...") when applicable. - Final result as the last log line: "Result: Team A wins" / "Result: Team B wins" / "Result: Draw". Implementation requirement: - Your code should be reasonably OOD: define Monster, Team, and BattleEngine (they can be nested inside the solution function). Return a BattleResult-like object (you may use a dict) containing the winner and the full log.

Mid March, 2026

OpenAI

Senior

Late February, 2026

OpenAI

Senior

Get Premium to View All 4 Reports

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.