diff --git a/notes/Leetcode 题解.md b/notes/Leetcode 题解.md index 9e9a3186..26976634 100644 --- a/notes/Leetcode 题解.md +++ b/notes/Leetcode 题解.md @@ -277,9 +277,7 @@ public boolean canPlaceFlowers(int[] flowerbed, int n) { ÌâÄ¿ÃèÊö£ºÅжÏÒ»¸öÊý×éÄܲ»ÄÜÖ»ÐÞ¸ÄÒ»¸öÊý¾Í³ÉΪ·ÇµÝ¼õÊý×é¡£ -ÔÚ nums[i] < nums[i - 1] µÄÇé¿öÏ£¬»áÓÅÏÈ¿¼ÂÇÁî nums[i - 1] = nums[i]£¬ÒòΪÈç¹ûÐÞ¸Ä nums[i] = nums[i - 1] µÄ»°£¬ÄÇô nums[i] Õâ¸öÊý»á±ä´ó£¬ÄÇô¾ÍÓпÉÄÜ±È nums[i + 1] ´ó£¬ÎÒÃÇÒª¾¡Á¿Ê¹ nums[i] ¸üС¡£ - -µ«ÊÇÔÚ nums[i] < nums[i - 2] µÄÇé¿öÏ£¬Ö»ÐÞ¸Ä nums[i - 1] ²»ÄÜÁîÊý×é³ÉΪ·ÇµÝ¼õ£¬Ö»ÄÜͨ¹ýÐÞ¸Ä nums[i] = nums[i - 1] ²ÅÐС£ +ÔÚ³öÏÖ nums[i] < nums[i - 1] ʱ£¬ÐèÒª¿¼ÂǵÄÊÇÓ¦¸ÃÐÞ¸ÄÊý×éµÄÄĸöÊý£¬Ê¹µÃ±¾´ÎÐÞ¸ÄÄÜʹ i ֮ǰµÄÊý×é³ÉΪ·ÇµÝ¼õÊý×飬²¢ÇÒ **²»Ó°ÏìºóÐøµÄ²Ù×÷**¡£ÓÅÏÈ¿¼ÂÇÁî nums[i - 1] = nums[i]£¬ÒòΪÈç¹ûÐÞ¸Ä nums[i] = nums[i - 1] µÄ»°£¬ÄÇô nums[i] Õâ¸öÊý»á±ä´ó£¬ÄÇô¾ÍÓпÉÄÜ±È nums[i + 1] ´ó£¬´Ó¶øÓ°ÏìÁ˺óÐø²Ù×÷¡£»¹ÓÐÒ»¸ö±È½ÏÌرðµÄÇé¿ö¾ÍÊÇ nums[i] < nums[i - 2]£¬Ö»ÐÞ¸Ä nums[i - 1] = nums[i] ²»ÄÜÁîÊý×é³ÉΪ·ÇµÝ¼õ£¬Ö»ÄÜͨ¹ýÐÞ¸Ä nums[i] = nums[i - 1] ²ÅÐС£ ```java public boolean checkPossibility(int[] nums) {