From 80a96b5d958f8b019852b0a47af7d9981d36af84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=93=AD=E7=8E=A5?= <15718462+vyueeee@user.noreply.gitee.com> Date: Tue, 14 Oct 2025 20:09:43 +0800 Subject: [PATCH] =?UTF-8?q?=20LC2273&LC198=E6=8F=90=E4=BA=A4=5F=E9=BB=84?= =?UTF-8?q?=E9=93=AD=E7=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._\351\273\204\351\223\255\347\216\245.cpp" | 19 +++++++++++++++++++ ..._\351\273\204\351\223\255\347\216\245.cpp" | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 "exercise/LC198_\351\273\204\351\223\255\347\216\245.cpp" create mode 100644 "exercise/LC2273_\351\273\204\351\223\255\347\216\245.cpp" diff --git "a/exercise/LC198_\351\273\204\351\223\255\347\216\245.cpp" "b/exercise/LC198_\351\273\204\351\223\255\347\216\245.cpp" new file mode 100644 index 0000000..4acb1c2 --- /dev/null +++ "b/exercise/LC198_\351\273\204\351\223\255\347\216\245.cpp" @@ -0,0 +1,19 @@ +class Solution { +public: + int rob(vector& nums) { + int len=nums.size(); + if(nums.empty()){ + return 0; + } + if(len==1){ + return nums[0]; + } + vector dp=vector(len,0); + dp[0]=nums[0]; + dp[1]=max(nums[0],nums[1]); + for(int i=2;i removeAnagrams(vector& words) { + vector str; + string prev=""; + for(int i=0;i