Think like the best software engineer and give e the code for :A Cvetond/ 8 Lnguage independ 0742 % A Suppose there s a sale on blue, green, an red shirts forthe next n days. On day i it: py 2 ‘ost b dolrs to buy a ble sir; dollars to buy a green sir, and , dollers 10 Goes, -: buy resi. You wih 0 buy a gl shi fo each for th net n days, but vith metas REESE ‘the caveat that you cannot buy the same color shirt on consecutive days. . § ® nt ent cml 5 [Rre— Fr . Implement the function (mc ct, sre ors, i es] whch takes u te ft feng scot) re ct rico Enc cement hese J ee a alsa , ist 53 postive niger that represents the dr pce of a shir. | & ‘our tasks 1 output a ist representing the shir colo you buy for each of then days, such thet the total combined cost of the n shirts is minimized. Specifically, [1] our tpt st wi be of nth 1, whee ach element thei chr) A = - ai NY pu] RS _ gn = 3 4 - — 35 a RE Ou el om os a Ong 5 5 Wane ~~ res) pap a * leet = 5.5, 7) peTTeoon Par— s ‘the output ist should be [57 7", 57] (total cost of 7). Buying only blue shirts free dab 125 fogert. re ‘Would be the cheapest, but remember that no two conseciive days can hove te. © sam lors uit i i eee . Pr 1 . © Eset 8, 15,3, 9) Gr - 7 cmet om. 5, 7,3] Ber | «lest - 3,30, 5, 1) . ‘the output fst should be(['=™, "g", v", "r]] (totel cost of 36). A 3 ji RS J a8 r=" Bk yf --
Question:
Think like the best software engineer and give e the code for :
A Cvetond/ 8 Lnguage independ 0742 %
A Suppose there s a sale on blue, green, an red shirts forthe next n days. On day i it:
py
2 ‘ost b dolrs to buy a ble sir; dollars to buy a green sir, and , dollers 10 Goes,
-: buy resi. You wih 0 buy a gl shi fo each for th net n days, but vith metas REESE
‘the caveat that you cannot buy the same color shirt on consecutive days. . §
® nt ent cml
5 [Rre— Fr
. Implement the function (mc ct, sre ors, i es] whch takes u
te ft feng scot) re ct rico Enc cement hese J ee a
alsa , ist 53 postive niger that represents the dr pce of a shir. |
& ‘our tasks 1 output a ist representing the shir colo you buy for each of then
days, such thet the total combined cost of the n shirts is minimized. Specifically, [1]
our tpt st wi be of nth 1, whee ach element thei chr)
A = -
ai NY pu] RS _ gn =
3 4 - —
35 a RE
Ou el om
os a Ong 5
5 Wane
~~ res) pap
a * leet = 5.5, 7)
peTTeoon Par—
s ‘the output ist should be [57 7", 57] (total cost of 7). Buying only blue shirts free dab 125 fogert. re
‘Would be the cheapest, but remember that no two conseciive days can hove te.
© sam lors uit
i i eee
. Pr 1 .
© Eset 8, 15,3, 9) Gr
- 7 cmet om. 5, 7,3]
Ber | «lest - 3,30, 5, 1)
.
‘the output fst should be(['=™, "g", v", "r]] (totel cost of 36).
A 3 ji RS
J a8
r=" Bk
yf --
Asked by: Hemanth Datta Nakka
Created at: 2025-07-29 21:12:41
Final Answer:
📢 Instructions:
- Ask anything relatd to above question only.
- For new Question goto :
VIPSolutions