From 153bda20f5aef0a055449b9439e027717bc2580b Mon Sep 17 00:00:00 2001 From: linlihong <747682928@qq.com> Date: Tue, 24 Sep 2024 17:18:45 +0800 Subject: [PATCH] 2024/9/24 Hot100 dp --- src/main/java/com/cool/hot100/dp/Num198.java | 45 ++++++++++++++++++++ src/main/java/com/cool/hot100/dp/Num279.java | 20 +++++++++ 2 files changed, 65 insertions(+) create mode 100644 src/main/java/com/cool/hot100/dp/Num198.java create mode 100644 src/main/java/com/cool/hot100/dp/Num279.java diff --git a/src/main/java/com/cool/hot100/dp/Num198.java b/src/main/java/com/cool/hot100/dp/Num198.java new file mode 100644 index 0000000..5b73ba5 --- /dev/null +++ b/src/main/java/com/cool/hot100/dp/Num198.java @@ -0,0 +1,45 @@ +package com.cool.hot100.dp; + +/** + * Created with IntelliJ IDEA. + * + * @Author: Cool + * @Date: 2024/09/24/14:10 + * DayNumber 1 + * Hard 2 + * Level ? + */ +public class Num198 { + /** + * 滚动数组 + * @param nums + * @return + */ + public int rob(int[] nums) { + int noSteal=0; + int steal=nums[0]; + for(int i=1;i