0

Pattern ??? i don't want any link from internet.. i just want to get a new idea Or different approach

1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1

29th Jan 2017, 6:09 PM
Somnath Ghosh
Somnath Ghosh - avatar
6 Answers
0
You can use the binomial coefficient to calculate each value: bc(n,k) = n! / (k! * (n-k)!) For n use the layer you are in, starting with 0, and for k the element you want to calculate, also starting at 0: bc(0,0) = 1 bc(1,0) = 1 bc(0,1) = 1 bc(2,0) = 1 bc(2,1) = 2 bc(2,2) = 1 bc(3,0) = 1 bc(3,1) = 3 bc(3,2) = 3 bc(3,3) = 1 And so on...
29th Jan 2017, 6:31 PM
Robobrine
Robobrine - avatar
0
i did exactly the same...but interviewer told don't use any complicated math...do it in simple way
30th Jan 2017, 6:29 PM
Somnath Ghosh
Somnath Ghosh - avatar
0
Well, you asked for a different approach, not a simple one xD
30th Jan 2017, 6:31 PM
Robobrine
Robobrine - avatar
0
yes..but it is not different for me..it is already on internet
30th Jan 2017, 6:33 PM
Somnath Ghosh
Somnath Ghosh - avatar
0
You probably won't find a completely new way to solve this problem anyways, especially if you ask in some forum...
30th Jan 2017, 6:36 PM
Robobrine
Robobrine - avatar
0
maybe we can...in the first diagonal difference is 0,then 1,then 2 then 3..so on
31st Jan 2017, 3:49 PM
Somnath Ghosh
Somnath Ghosh - avatar