@@ -317,7 +317,16 @@ int maxProfit_k_1(int[] prices) {
317
317
}
318
318
```
319
319
320
- < visual slug=" best-time-to-buy-and-sell-stock" / >
320
+
321
+ < hr/ >
322
+ < a href=" https://labuladong.online/algo-visualize/leetcode/best-time-to-buy-and-sell-stock/" target=" _blank" >
323
+ < details style=" max-width:90%;max-height:400px" >
324
+ < summary>
325
+ < strong> 🍭 代码可视化动画🍭< / strong>
326
+ < / summary>
327
+ < / details>
328
+ < / a>
329
+ < hr/ >
321
330
322
331
两种方式都是一样的,不过这种编程方法简洁很多,但是如果没有前面状态转移方程的引导,是肯定看不懂的。后续的题目,你可以对比一下如何把 `dp` 数组的空间优化掉。
323
332
@@ -374,7 +383,16 @@ int maxProfit_k_inf(int[] prices) {
374
383
}
375
384
```
376
385
377
- < visual slug=" best-time-to-buy-and-sell-stock-ii" / >
386
+
387
+ < hr/ >
388
+ < a href=" https://labuladong.online/algo-visualize/leetcode/best-time-to-buy-and-sell-stock-ii/" target=" _blank" >
389
+ < details style=" max-width:90%;max-height:400px" >
390
+ < summary>
391
+ < strong> 🌟 代码可视化动画🌟< / strong>
392
+ < / summary>
393
+ < / details>
394
+ < / a>
395
+ < hr/ >
378
396
379
397
# ## 309. 最佳买卖股票时机含冷冻期
380
398
@@ -437,7 +455,16 @@ int maxProfit_with_cool(int[] prices) {
437
455
}
438
456
```
439
457
440
- < visual slug=" best-time-to-buy-and-sell-stock-with-cooldown" / >
458
+
459
+ < hr/ >
460
+ < a href=" https://labuladong.online/algo-visualize/leetcode/best-time-to-buy-and-sell-stock-with-cooldown/" target=" _blank" >
461
+ < details style=" max-width:90%;max-height:400px" >
462
+ < summary>
463
+ < strong> 🌈 代码可视化动画🌈< / strong>
464
+ < / summary>
465
+ < / details>
466
+ < / a>
467
+ < hr/ >
441
468
442
469
# ## 714. 买卖股票的最佳时机含手续费
443
470
@@ -497,7 +524,16 @@ int maxProfit_with_fee(int[] prices, int fee) {
497
524
}
498
525
```
499
526
500
- < visual slug=" best-time-to-buy-and-sell-stock-with-transaction-fee" / >
527
+
528
+ < hr/ >
529
+ < a href=" https://labuladong.online/algo-visualize/leetcode/best-time-to-buy-and-sell-stock-with-transaction-fee/" target=" _blank" >
530
+ < details style=" max-width:90%;max-height:400px" >
531
+ < summary>
532
+ < strong> 🌈 代码可视化动画🌈< / strong>
533
+ < / summary>
534
+ < / details>
535
+ < / a>
536
+ < hr/ >
501
537
502
538
503
539
@@ -575,7 +611,16 @@ int maxProfit_k_2(int[] prices) {
575
611
}
576
612
```
577
613
578
- < visual slug=" best-time-to-buy-and-sell-stock-iii" / >
614
+
615
+ < hr/ >
616
+ < a href=" https://labuladong.online/algo-visualize/leetcode/best-time-to-buy-and-sell-stock-iii/" target=" _blank" >
617
+ < details style=" max-width:90%;max-height:400px" >
618
+ < summary>
619
+ < strong> 🍭 代码可视化动画🍭< / strong>
620
+ < / summary>
621
+ < / details>
622
+ < / a>
623
+ < hr/ >
579
624
580
625
581
626
@@ -666,7 +711,16 @@ int maxProfit_k_any(int max_k, int[] prices) {
666
711
}
667
712
```
668
713
669
- < visual slug=" best-time-to-buy-and-sell-stock-iv" / >
714
+
715
+ < hr/ >
716
+ < a href=" https://labuladong.online/algo-visualize/leetcode/best-time-to-buy-and-sell-stock-iv/" target=" _blank" >
717
+ < details style=" max-width:90%;max-height:400px" >
718
+ < summary>
719
+ < strong> 🌟 代码可视化动画🌟< / strong>
720
+ < / summary>
721
+ < / details>
722
+ < / a>
723
+ < hr/ >
670
724
671
725
672
726
0 commit comments