Leetcode 650 | 2 key keyboard | Medium | Recursion + Memoization | Full Explaination | English

Описание к видео Leetcode 650 | 2 key keyboard | Medium | Recursion + Memoization | Full Explaination | English

Question NO- 650
Question Name- 2 key keyboard
Daily Question - 19/Aug/2024
Topic - Dynamic Programming
Solution -Recursion + Memoization.
TL - O(n^2)
ML - O(n^2)
Difficulty - Medium ( Easier then many medium DP problems)

Recursive Function -
f(length, copied) =

= min( f(length+copied, copied) , f(length+length , length ) , for length less than n,

= 0 , for length == n

= int-max, for length greater than n

Note that length is current number of 'A' present in screen and copied is the current copied number of 'A'.

#leetcodethehardway #leetcode #leetcodechallenge #lc #lc650 #programming #learning

Комментарии

Информация по комментариям в разработке