FastPrepMadam C.J. Walker's Business Plan
Problems/Madam C.J. Walker's Business Plan

Madam C.J. Walker's Business Plan

Fortinet logoFortinet● HardOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Madam C.J. Walker, known as the first African-American businesswoman in America, had a business model involving the sale of cosmetics and perfumes for women, which can be likened to a modified 0-1 knapsack problem.

There are n different products available for purchase and resale. The cost of the i item is given by cost[i], and it can be resold for a profit of 2 ** i.

Given the total available to x to invest, determine the maximum profit that can be generated with the given amount of money. Since the answer can be quite large, return the result modulo (10 ** 9 + 7).

Function

calculateMaximumProfit(cost: int[], x: int) → int

Complete the function calculateMaximumProfit in the editor.

calculateMaximumProfit has the following parameters:

  1. cost: List[int]: an array of integers representing the cost of each item
  2. x: int: the total amount available to invest

Returns int: the maximum profit that can be generated modulo (10 ** 9 + 7)

All credit goes to an incredible friend who made it all possible! 🧡

Examples

Example 1

cost = [10, 20, 14, 40, 50]x = 70return = 20
  • Items 0, 1, and 2 for a cost of 44 and obtain a profit of 2 ** 0 + 2 ** 1 + 2 ** 2 = 7
  • Items 0 and 4 for a cost of 60 and obtain a profit of 2 ** 0 + 2 ** 4 = 17
  • Items 1 and 4 for a cost of 70 and obtain a profit of 2 ** 1 + 2 ** 4 = 18
  • Items 2 and 4 for a cost of 64 and obtain a profit of 2 ** 2 + 2 ** 4 = 20

Out of all the possible combinations, the maximum profit is 20 when purchasing items 2 and 4 for a cost of 64.

More Fortinet interview questions

  • Checksum AggregatorOA · Seen Jun 2025
  • K-Means ClusteringOA · Seen Jun 2025
  • Signal PingsOA · Seen Jun 2025
  • Maximize Beautiful SubstringsOA · Seen Mar 2025

Similar questions at other companies

  • Delete K Subsets for Maximum ScoreRubrik · OARubrik interview questions
  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Maximum Index-Weighted Sum with Disjoint SwapsVisa · OAVisa interview questions
  • Submask Sum QueriesIntuit · OAIntuit interview questions
  • Distinct Bitwise-OR Scores of Increasing SubsequencesWalmart · OAWalmart interview questions
  • Match an XOR-Adjusted SumSquarepoint Capital · OASquarepoint Capital interview questions
  • Count Divisible PermutationsDeloitte · OADeloitte interview questions
  • Get Distinct Goodness ValuesCitadel · OACitadel interview questions
  • Max ProfitIBM · OAIBM interview questions
  • Distinct OR Values of Increasing SubsequencesScale AI · OAScale AI interview questions
All Fortinet interview questionsSee Fortinet hiring insights
Saved
class Solution {
    public int calculateMaximumProfit(int[] cost, int x) {
      // write your code here
    }

}
Checking account…