动态规划
class Solution:def rob(self, nums: List[int]) -> int:# 数组长度n = len(nums)if n == 1:return nums[0]# 打家劫舍1中的函数def rob1(start, end):if start == end:return nums[start]# 动态规划指针first = 0second = nums[start]third = nums[start]# 动态规划操作for i in range(start+2, end+2):third = max(second, first+nums[i-1])first = secondsecond = thirdreturn thirdreturn max(rob1(0, n-2), rob1(1, n-1))
sql练习
607. 销售员
小黑代码
# Write your MySQL query statement below
SELECTname
FROMSalesPerson
WHEREname NOT IN(SELECTSalesPerson.nameFROMSalesPerson LEFT JOIN Orders ON SalesPerson.sales_id = Orders.sales_idLEFT JOIN Company ON Orders.com_id = Company.com_idWHERECompany.name = 'RED')
小黑看完官方题解后
# Write your MySQL query statement below
SELECTname
FROMSalesPerson
WHEREsales_id NOT In(SELECTsales_idFROMOrders, CompanyWHERECompany.name = 'RED' AND Orders.com_id = Company.com_id)
Pandas练习
607. 销售员
import pandas as pddef sales_person(sales_person: pd.DataFrame, company: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame:# 表连接df = orders.merge(company, how='inner', left_on='com_id', right_on='com_id')[['sales_id', 'name']]# 筛选RED对应sale_idRED_sales_id = set(df[df['name'] == 'RED']['sales_id'])# NOT IN操作return sales_person[~sales_person['sales_id'].isin(RED_sales_id)][['name']]
小黑生活
喜茶学习完,准备练琴
怀柔马拉松出了参赛号码
练琴完吃个烤冷面
小汤3《牛仔之歌》打卡
上午参加婚礼
花了300元报了一个半程和一个全程,要攒钱啊,路费酒店费
来个咖啡醒醒酒
准备回姥姥家看一下店
去怀柔的火车票去程也买好了
边看店边刷题
晚饭家里来个铜锅