you give array price pricesi price give stock ith dayfind maximum profit achieve you complete transactionsnote you engage multiple transaction simultaneously ie sell stock buy Example 1input price 33500314output 6explanation Buy day 4 price 0 sell day 6 price 3 profit 30 3then buy day 7 price 1 sell day 8 price 4 profit 41 3example 2input price 12345output 4explanation Buy day 1 price 1 sell day 5 price 5 profit 51 4note buy day 1 buy day 2 sell later engage multiple transaction time you sell buy againexample 3input price 76431output 0explanation in case transaction ie max profit 0 Constraints1 priceslength 1050 pricesi 105