Skip to content

Latest commit

 

History

History
5 lines (4 loc) · 339 Bytes

File metadata and controls

5 lines (4 loc) · 339 Bytes

backtracking-

Given an array of n elements with all elements positive generate all possible according to 2 rules:- 1)Consider any 2 adjacent elements i and i+1 and i+1 is not the last element so you can decrease both by 1 and add 1 to the i+1 th element. 2)if i+1 is the last element so u can reduce both by 1 and append 1 to the last.