Garlic Butter Cajun Steak Bites with Creamy Alfredo Rotini Pasta

<|begin▁of▁sentence|># 1. 题目

#### [1049. 最后一块石头的重量 II](https://leetcode-cn.com/problems/last-stone-weight-ii/)

难度中等421

有一堆石头,用整数数组 `stones` 表示。其中 `stones[i]` 表示第 `i` 块石头的重量。

每一回合,从中选出**任意两块石头**,然后将它们一起粉碎。假设石头的重量分别为 `x` 和 `y`,且 `x <= y`。那么粉碎的可能结果如下: - 如果 `x == y`,那么两块石头都会被完全粉碎; - 如果 `x != y`,那么重量为 `x` 的石头将会完全粉碎,而重量为 `y` 的石头新重量为 `y-x`。 最后,**最多只会剩下一块** 石头。返回此石头 **最小的可能重量** 。如果没有石头剩下,就返回 `0`。 **示例 1:** ``` 输入:stones = [2,7,4,1,8,1] 输出:1 解释: 组合 2 和 4,得到 2,所以数组转化为 [2,7,1,8,1], 组合 7 和 8,得到 1,所以数组转化为 [2,1,1,1], 组合 2 和 1,得到 1,所以数组转化为 [1,1,1], 组合 1 和 1,得到 0,所以数组转化为 [1],这就是最优值。 ``` **示例 2:** ``` 输入:stones = [31,26,33,21,40] 输出:5 ``` **提示:** - `1 <= stones.length <= 30` - `1 <= stones[i] <= 100` # 2. 题解 # 3. code ```c++ class Solution { public: int lastStoneWeightII(vector& stones) {
int sum = 0;
for (int i = 0; i < stones.size(); i++) { sum += stones[i]; } int target = sum / 2; vector dp(target + 1, 0);
for (int i = 0; i < stones.size(); i++) { for (int j = target; j >= stones[i]; j–) {
dp[j] = max(dp[j], dp[j – stones[i]] + stones[i]);
}
}
return sum – dp[target] – dp[target];
}
};
“`
# 4. 心得

01背包问题,需要理解题意,将石头分成两堆,两堆的差值最小。

因此,需要找到容量为sum/2的背包最多能装多少石头,然后sum – dp[target] – dp[target]就是差值。

Print
clock clock iconcutlery cutlery iconflag flag iconfolder folder iconinstagram instagram iconpinterest pinterest iconfacebook facebook iconprint print iconsquares squares iconheart heart iconheart solid heart solid icon

Garlic Butter Cajun Steak Bites with Creamy Alfredo Rotini Twist


5 Stars 4 Stars 3 Stars 2 Stars 1 Star

No reviews

  • Author: Chef Billy

Description

Tender steak bites seasoned with bold Cajun spices, seared in garlic butter, and served over creamy Alfredo rotini pasta for a comforting and flavorful meal.


Ingredients

Scale

For the Crust:

  • 1 lb sirloin steak, cut into bite-sized pieces
  • 2 tbsp Cajun seasoning
  • 3 tbsp butter
  • 4 cloves garlic, minced
  • 8 oz rotini pasta
  • 1 cup heavy cream
  • 1/2 cup grated Parmesan cheese
  • Salt and black pepper to taste
  • Fresh parsley, chopped (for garnish)

Instructions

1. Prepare the Crust:

  1. Season steak bites with Cajun seasoning, ensuring they are evenly coated.
  2. Cook rotini according to package directions until al dente, then drain and set aside.
  3. In a large skillet, melt butter over medium-high heat. Add garlic and sauté for 1 minute until fragrant.
  4. Add seasoned steak bites to the skillet and sear for 4-5 minutes, until browned and cooked to your desired doneness.
  5. Reduce heat to low, pour in heavy cream and Parmesan cheese, stirring until the sauce thickens slightly.
  6. Add cooked rotini to the skillet, tossing to coat evenly with the sauce. Season with salt and pepper as needed.
  7. Garnish with fresh parsley and serve immediately.

Notes

You can customize the seasonings to taste.

Share it :

Leave a Comment

Recipe rating 5 Stars 4 Stars 3 Stars 2 Stars 1 Star

From Novice to Chef
Discover all our recipes and articles to level up your cooking skills !
Welcome to my kitchen, where time around the table is more important than what is on it. Join me in making easy, delicious recipes your whole family will love.
Copyright © 2024 Billyrecipes, All rights reserved. Powered by Billyrecipes.com