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
6 Respostas
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...
0
i did exactly the same...but interviewer told don't use any complicated math...do it in simple way
0
Well, you asked for a different approach, not a simple one xD
0
yes..but it is not different for me..it is already on internet
0
You probably won't find a completely new way to solve this problem anyways, especially if you ask in some forum...
0
maybe we can...in the first diagonal difference is 0,then 1,then 2 then 3..so on