← Boston Consulting Group Interview Insights

Boston Consulting Group·AI Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

BCG AI Engineer interview with a math/logic puzzle that felt more like a coding challenge than anything AI-related. Just the one question shared here but it was a bit of a curveball.

Questions Asked (1)

Q1

Given a specific month and day, along with the moon phase on January 1st, calculate what moon phase it would be on that date. Assume standard month lengths and a cycle of 8 repeating phases.

Algorithms & Data Structures
Author's notes

Took me a minute to even parse what they were asking.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints: whether the year is a leap year, how to handle month lengths, and the exact phase names. Then, compute the total number of days from January 1st to the target date, add the offset of the given moon phase on January 1st, and take modulo 8 to find the new phase index.

Pro tip: Mention edge cases like leap years and validate with a simple example (e.g., January 1st itself) to show thoroughness. Also, discuss how you would extend the solution to handle varying cycle lengths or real astronomical data.

1. Clarify assumptions and inputs

Confirm the year (to determine leap year), the phase names and their order, and whether the given phase on Jan 1 is an index or name. Establish that standard month lengths are used, but leap years affect February.

2. Map phases to indices

Assign each of the 8 phases a numerical index (e.g., 0 to 7) in a consistent order, such as New Moon=0, Waxing Crescent=1, etc. This allows modular arithmetic.

3. Compute days elapsed

Calculate the total number of days from January 1st to the target date. Use an array of cumulative days per month, adjusting for leap year if necessary. Subtract 1 if counting from Jan 1 as day 0, or keep as is if Jan 1 is day 1.

4. Calculate new phase index

Add the days elapsed to the initial phase index, then take modulo 8. This gives the new phase index. Map back to the phase name.

5. Validate and discuss edge cases

Test with simple cases (e.g., same date, next day) and discuss handling of leap years, invalid dates, and potential extensions like using real lunar cycle data.

Key Points to Mention

  • Leap year handling: February has 29 days in leap years, affecting total day count.
  • Modular arithmetic: Use modulo 8 to wrap around the cycle of phases.
  • Phase indexing: Consistent mapping of phase names to indices (e.g., 0-7) is crucial.
  • Day counting convention: Decide whether Jan 1 is day 0 or day 1 to avoid off-by-one errors.
  • Edge cases: Validate with dates like Jan 1, Dec 31, and leap day (Feb 29).
  • Scalability: Discuss how to adapt the solution for real astronomical moon phases or different cycle lengths.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.