KatInterview

Unit Sales Target After Fixed Cost Increase

Math & Bit ManipulationAuto-graded · 19 test cases
EasyAuto-gradedMath & Bit Manipulationmathbusiness-logicformulas

Last updated

Tests cost-volume-profit analysis by computing last period's profit and the sales volume needed to maintain that profit when fixed costs rise.

You're analyzing a business that sells one product. You need to determine how last period's profitability translates into a sales target for the next period when overhead expenses increase.

Problem

Given the following information about a business:

  • Initial annual fixed costs
  • Unit selling price
  • Variable cost per unit
  • Units sold in the prior period
  • Expected increase in fixed costs for the next period

Your task is to:

  1. Calculate the net profit achieved in the prior period
  2. Determine how many units must be sold in the next period to achieve that same net profit, given the higher fixed costs

Input

You receive five integers:

  • initial_fixed_cost: the fixed costs during the prior period
  • selling_price: the price at which each unit is sold
  • variable_cost: the variable cost incurred per unit sold
  • prior_units: the number of units sold in the prior period
  • fixed_cost_increase: the additional fixed costs expected in the next period

Output

Return a list of two numbers:

  1. The net profit from the prior period (as a float)
  2. The number of units required in the next period to match that profit (as a float)

Constraints

  • All input values are non-negative integers
  • selling_price > variable_cost (each unit contributes positively)
  • prior_units >= 0
  • Assume all units produced are sold immediately
  • Ignore taxes, interest, and depreciation
  • The selling price and variable cost remain constant across both periods

Examples

Example 1

Input: calculate_sales_target(500000, 100, 60, 20000, 100000)

Output: [300000, 22500]

Example 2

Input: calculate_sales_target(100000, 50, 30, 5000, 25000)

Output: [0, 6250]

Example 3

Input: calculate_sales_target(750000, 125, 75, 30000, 150000)

Output: [750000, 33000]

Hints

Hint 1

Calculate the contribution margin first: how much each unit contributes toward covering fixed costs and generating profit

Hint 2

Use the profit formula: Net Profit = (Units × Contribution Margin) - Fixed Costs

Hint 3

The additional fixed costs must be covered by additional contribution margin from extra unit sales