but the doubt over here is you are incrementing the spaces in every traversal as well as decrementing it then how come it may give you a proper triangle order?
See , you are first displaying the number, then calculating the next number (in the index of the first number) 1st iteration number = 1 is displayed first (2nd number is calculated but loop runs only once, so not displayed) 2nd iteration number = 1 is displayed first, 2nd number is calculated in the same index which comes out to be 1 (i -> 1, j -> 0) 3rd iteration number = 1 is displayed first, 2nd number is calculated in the same index which comes out to be 2 (i- > 2, j -> 0) and same for 3rd number
I have little bit of problem with this formula. Actually it's against the standard and conventional programming. Because it has spilled values. when you have j=2 and i = 3 your formula turns out number = number * (3-2)/(2+1) ==> number = number * (1)/(3) ==> number = number * 0.33 though int/int show integer value 0.. this is against a good programming.
I spent three days in finding a better understandable solution of pascal triangle finally i got this video
After searching a lot I find trigular format solution here. I implemented the same thing in scala. Appreciate your help. Thanks!
Do you understand this equation ?
Thank You i learned too much with your help.
class Solution(object):
def generate(self, numRows):
my_list=[]
prev_list=[]
prev_list.append(1)
if numRows==1:
return [prev_list]
else:
for i in range(0,numRows):
list1=[]
for j in range(0,i):
if j==0:
list1.append(1)
else:
list1.append(prev_list[j]+prev_list[j-1])
list1.append(1)
prev_list=list1
my_list.append(list1)
return my_list
try this
THANK YOU SIR, RESPECT! now i can do my assignment :') keep it up!
Sir I can clearly understand ur teaching please explain some more topics...
i don,t understand how the equation i-j/i+j work beacaue i and j increment at the time
Thankyou very much for explaining
Plz make a video on reverse a full sentence word by word eg. Sky is blue to blue is sky in java plz .. ..make a video on it
but the doubt over here is you are incrementing the spaces in every traversal as well as decrementing it then how come it may give you a proper triangle order?
it works💥💥
Thank you sir🙌✨
Thank You Sir!
How to generate these formula
in the first iteration i and j both are zero th number should be zer
o
i am getting confused in this part😵💫😵💫
See , you are first displaying the number, then calculating the next number (in the index of the first number)
1st iteration number = 1 is displayed first (2nd number is calculated but loop runs only once, so not displayed)
2nd iteration number = 1 is displayed first, 2nd number is calculated in the same index which comes out to be 1 (i -> 1, j -> 0)
3rd iteration number = 1 is displayed first, 2nd number is calculated in the same index which comes out to be 2 (i- > 2, j -> 0) and same for 3rd number
superbbbb..SIR..
It wont display properly when numbers get to 3 digit length but nice compact solution
I have little bit of problem with this formula. Actually it's against the standard and conventional programming. Because it has spilled values. when you have j=2 and i = 3
your formula turns out number = number * (3-2)/(2+1)
==> number = number * (1)/(3)
==> number = number * 0.33
though int/int show integer value 0.. this is against a good programming.
Can you do 2D array for the same example
not working for 6 lines
sir how to install eclipse ?
Working
thx
You save me 😅😅