Vesting Schedule Domain Model: Cliff, Periodic Vesting, Termination and Acceleration

Quick Overview

Design a vesting schedule class that returns the shares vested at any month, with a cliff, periodic installments, an optional termination date and an optional acceleration date. It tests the ordering of business rules, integer share rounding and boundary handling in a small domain model.

Vesting Schedule Domain Model: Cliff, Periodic Vesting, Termination and Acceleration

Company: Carta

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Other

Design a `VestingSchedule` class that models a standard equity vesting schedule with a configurable total duration, cliff period and vesting frequency (for example, a 4-year vest with a 1-year cliff and monthly vesting thereafter). The schedule is initialized with a grant date, a total number of shares, and optional termination or acceleration dates. Before the cliff is reached, zero shares are vested. At the cliff, the proportional cliff amount vests in one chunk. After the cliff, shares vest in equal installments at each frequency interval until the total duration completes. If a termination date is provided, no further shares vest after that date. If an acceleration date is provided, all remaining unvested shares vest immediately on that date. Acceleration takes precedence over termination when the acceleration date is on or before the termination date. All dates are integer timestamps representing the number of months since a fixed epoch. The constructor takes its arguments in this order, with `-1` meaning a date is not set: ```python VestingSchedule(grantDate, totalShares, totalMonths, cliffMonths, frequencyMonths, terminationDate, accelerationDate) ``` Implement one method: - `getVestedShares(timestamp: int) -> int` returns the integer number of shares vested as of the given timestamp, accounting for the cliff, periodic vesting, termination and acceleration. ```hint Order of the checks Trace a schedule where the acceleration date falls after the termination date, and another where it falls before the cliff. The order in which you apply termination, acceleration and the cliff decides both answers. ``` ```hint Whole shares Share counts are integers and the installments have to add up to the full grant. Work out where the leftover shares go when the post-cliff amount does not split evenly across the periods. ``` ### Examples Example 1: a 4-year vest of 4800 shares with a 1-year cliff and monthly vesting after it. ```python vs = VestingSchedule(0, 4800, 48, 12, 1, -1, -1) vs.getVestedShares(0) # 0 grant date, before the cliff vs.getVestedShares(11) # 0 one month before the cliff vs.getVestedShares(12) # 1200 cliff reached: 12/48 of 4800 vs.getVestedShares(24) # 2400 cliff plus 12 monthly installments of 100 vs.getVestedShares(47) # 4700 one month before full vest vs.getVestedShares(48) # 4800 fully vested ``` Example 2: the same schedule with termination at month 30 and acceleration at month 20. ```python vs = VestingSchedule(0, 4800, 48, 12, 1, 30, 20) vs.getVestedShares(15) # 1500 cliff plus 3 monthly installments vs.getVestedShares(20) # 4800 acceleration vests everything vs.getVestedShares(25) # 4800 already accelerated vs.getVestedShares(100) # 4800 acceleration (month 20) came before termination (month 30) ``` ### Constraints & Assumptions - `1 <= totalShares <= 10^9` - `0 <= cliffMonths <= totalMonths <= 600` - `1 <= frequencyMonths <= totalMonths` - `frequencyMonths` divides `totalMonths - cliffMonths` - `grantDate`, `terminationDate`, `accelerationDate` and the query `timestamp` are integers (months since the epoch) - `terminationDate` and `accelerationDate` may be `-1` to indicate not set - At most `10^4` calls to `getVestedShares` ### Clarifying Questions to Ask - When the shares do not divide evenly, how should each installment be rounded, and which installment absorbs the leftover shares? - If the acceleration date falls after the termination date, does the acceleration still apply? - Does a vesting event that lands exactly on the termination date count? - Can a query come before the grant date, and should it return 0? ### What a Strong Answer Covers - Precomputing the cliff amount, the number of periods and the per-period amount once, so each query runs in constant time. - An order of termination, acceleration and cliff checks that gives the right answer when acceleration falls before the cliff or after termination. - A rounding rule that keeps share counts whole and makes the installments sum exactly to the grant. - Correct boundaries at the cliff month, on the termination date, at the final month and past the end of the schedule. - Degenerate schedules such as a zero cliff or a cliff equal to the full duration. ### Follow-up Questions - How would you support partial acceleration, where only a fixed percentage of the unvested shares vests early? - How would you model uneven tranches, such as a schedule that vests 10%, 20%, 30% and 40% in its four years? - How would you move from month offsets to calendar dates, including grants made on the 29th, 30th or 31st of a month? - How would you return the full list of vesting events for display and keep it consistent with `getVestedShares`?

Overview: Design a vesting schedule class that returns the shares vested at any month, with a cliff, periodic installments, an optional termination date and an optional acceleration date. It tests the ordering of business rules, integer share rounding and boundary handling in a small domain model.

Carta logo
Carta
Nov 25, 2026
mediumSoftware EngineerOtherSoftware Engineering Fundamentals
0
0

Design a VestingSchedule class that models a standard equity vesting schedule with a configurable total duration, cliff period and vesting frequency (for example, a 4-year vest with a 1-year cliff and monthly vesting thereafter).

The schedule is initialized with a grant date, a total number of shares, and optional termination or acceleration dates. Before the cliff is reached, zero shares are vested. At the cliff, the proportional cliff amount vests in one chunk. After the cliff, shares vest in equal installments at each frequency interval until the total duration completes.

If a termination date is provided, no further shares vest after that date. If an acceleration date is provided, all remaining unvested shares vest immediately on that date. Acceleration takes precedence over termination when the acceleration date is on or before the termination date.

All dates are integer timestamps representing the number of months since a fixed epoch. The constructor takes its arguments in this order, with -1 meaning a date is not set:

VestingSchedule(grantDate, totalShares, totalMonths, cliffMonths, frequencyMonths, terminationDate, accelerationDate)

Implement one method:

  • getVestedShares(timestamp: int) -> int returns the integer number of shares vested as of the given timestamp, accounting for the cliff, periodic vesting, termination and acceleration.

Examples

Example 1: a 4-year vest of 4800 shares with a 1-year cliff and monthly vesting after it.

vs = VestingSchedule(0, 4800, 48, 12, 1, -1, -1)

vs.getVestedShares(0)    # 0     grant date, before the cliff
vs.getVestedShares(11)   # 0     one month before the cliff
vs.getVestedShares(12)   # 1200  cliff reached: 12/48 of 4800
vs.getVestedShares(24)   # 2400  cliff plus 12 monthly installments of 100
vs.getVestedShares(47)   # 4700  one month before full vest
vs.getVestedShares(48)   # 4800  fully vested

Example 2: the same schedule with termination at month 30 and acceleration at month 20.

vs = VestingSchedule(0, 4800, 48, 12, 1, 30, 20)

vs.getVestedShares(15)   # 1500  cliff plus 3 monthly installments
vs.getVestedShares(20)   # 4800  acceleration vests everything
vs.getVestedShares(25)   # 4800  already accelerated
vs.getVestedShares(100)  # 4800  acceleration (month 20) came before termination (month 30)

Constraints & Assumptions

  • 1 <= totalShares <= 10^9
  • 0 <= cliffMonths <= totalMonths <= 600
  • 1 <= frequencyMonths <= totalMonths
  • frequencyMonths divides totalMonths - cliffMonths
  • grantDate , terminationDate , accelerationDate and the query timestamp are integers (months since the epoch)
  • terminationDate and accelerationDate may be -1 to indicate not set
  • At most 10^4 calls to getVestedShares

Clarifying Questions to Ask Guidance

  • When the shares do not divide evenly, how should each installment be rounded, and which installment absorbs the leftover shares?
  • If the acceleration date falls after the termination date, does the acceleration still apply?
  • Does a vesting event that lands exactly on the termination date count?
  • Can a query come before the grant date, and should it return 0?

What a Strong Answer Covers Guidance

  • Precomputing the cliff amount, the number of periods and the per-period amount once, so each query runs in constant time.
  • An order of termination, acceleration and cliff checks that gives the right answer when acceleration falls before the cliff or after termination.
  • A rounding rule that keeps share counts whole and makes the installments sum exactly to the grant.
  • Correct boundaries at the cliff month, on the termination date, at the final month and past the end of the schedule.
  • Degenerate schedules such as a zero cliff or a cliff equal to the full duration.

Follow-up Questions Guidance

  • How would you support partial acceleration, where only a fixed percentage of the unvested shares vests early?
  • How would you model uneven tranches, such as a schedule that vests 10%, 20%, 30% and 40% in its four years?
  • How would you move from month offsets to calendar dates, including grants made on the 29th, 30th or 31st of a month?
  • How would you return the full list of vesting events for display and keep it consistent with getVestedShares ?