this problem consist subproblem solve subproblem F1 receive 8 point solve subproblem F2 receive 15 point solve subproblem F3 receive 10 pointsManao develop model predict stock price company n day want design profitmaximize trading algorithm use prediction unfortunately Manaos trading account follow restriction it allow own zero share stock time it allow buy sell share stock day it allow maximum k buy order n day for purpose problem define trade act buy share stock day hold stock day ji point share sell to restate constraint Manao permit k nonoverlapping trade course nday trading period Manaos model prediction stock priceeven restriction limit profit Manao compare achievable unlimited number trade ability hold share time Manao potential lot money Manaos model perfectly predict daily price stock for example model Manao wait price low buy share hold price reach high value sell profit repeat process k time n day passednevertheless Manao satisfied have merely good trading algorithm want develop optimal strategy trading subject constraint help Manao achieve goal write program determine buy sell stock achieve great possible profit nday trading period subject constraint