From 093dcfc241a273998f8ec74b452bd926ef1e5dd3 Mon Sep 17 00:00:00 2001 From: oheunhyuck <71165142+oheunhyuck@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:13:25 +0900 Subject: [PATCH] Create 1986. Minimum Number of Work Sessions to Finish the Tasks --- ...mber of Work Sessions to Finish the Tasks" | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "leetcode3/\354\230\244\354\235\200\355\230\201/1986. Minimum Number of Work Sessions to Finish the Tasks" diff --git "a/leetcode3/\354\230\244\354\235\200\355\230\201/1986. Minimum Number of Work Sessions to Finish the Tasks" "b/leetcode3/\354\230\244\354\235\200\355\230\201/1986. Minimum Number of Work Sessions to Finish the Tasks" new file mode 100644 index 00000000..24197040 --- /dev/null +++ "b/leetcode3/\354\230\244\354\235\200\355\230\201/1986. Minimum Number of Work Sessions to Finish the Tasks" @@ -0,0 +1,32 @@ +class Solution: + def search(self,cnt,tasks,mask,lt,dp,sessionTime): + if dp[mask][0]= lt:return + + dp[mask][0]=cnt + dp[mask][1]=lt + + + + + + + for i in range(len(tasks)): + if mask & (1<=tasks[i]: + self.search(cnt,tasks,mask | (1< int: + mask=1 + dp=[[float('inf'),-float('inf')] for _ in range(2**len(tasks))] + + + self.search(1,tasks,mask,sessionTime-tasks[0],dp,sessionTime) + + return dp[-1][0] +