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