Given a triangle and a number n find how many number of ways you can return to the same vertex where you started with total path distance n. Only a fe
Answers
Answered by
0
three different array ... Time Complexity: O(N^3) where N is the size of input array. ... And we check for condition (i) when we pick 'k'. 4.
Answered by
0
Answer:
Input: n = 3
Output: 4
Explanation:
Below are the four ways
1 step + 1 step + 1 step
1 step + 2 step
2 step + 1 step
3 step
Input: n = 4
Output: 7
Explanation:
Below are the four ways
1 step + 1 step + 1 step + 1 step
1 step + 2 step + 1 step
2 step + 1 step + 1 step
1 step + 1 step + 2 step
2 step + 2 step
3 step + 1 step
1 step + 3 step
#SPJ2
Similar questions