Weighted Sum of given input :
1,2,3,(4(5)),6 = 1 + 2 + 3 + 2* (4 + 3*5) + 6
Define the right datastructure (just design) and write the algorithm
Given a binary matrix where each row is sorted find left-most 1. Return column number as answer.
Input :
0 0 0 1 1
0 0 1 1 1
0 0 0 0 1
Output = 2 (since 1 is present in 3rd colum (0 based index) and it is left-most)