rishiilluri

Untitled

Sep 30th, 2022
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. def can_take_courses(c,n,size, v):
  2.     if n ==0:
  3.         print(v)
  4.         return
  5.     if size==0:
  6.         return
  7.  
  8.     can_take_courses(c,n, size-1, v)
  9.     arr = v.copy()
  10.     arr.append(c[size-1])
  11.     can_take_courses(c,n-c[size-1], size-1, arr)
  12.    
  13. v = []
  14. can_take_courses([1,2,3,4], 5, 4, v)
Advertisement
Add Comment
Please, Sign In to add comment