How to solve a Dynamic Programming Problem ? | This function returns the number of arrangements to form 'n ; lookup dictionary / hashmap is initialized ; Base cases negative number can 't be  produced, return 0 ; 0 can be produced by not taking any number whereas 1 can be produced by just taking 1 ; Checking if number of way for producing n is already calculated or not if calculated , return that , otherwise calulcate and then return
' NEW_LINE def solve ( n , lookup = { } ) : NEW_LINE INDENT if n < 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT if n == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT if n not in lookup : NEW_LINE INDENT lookup [ n ] = ( solve ( n - 1 ) + solve ( n - 3 ) + solve ( n - 5 ) ) NEW_LINE DEDENT return lookup [ n ] NEW_LINE DEDENT