Java code for Printing Pascal Triangle

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 28

  • @abhaykumar4680
    @abhaykumar4680 ปีที่แล้ว

    I spent three days in finding a better understandable solution of pascal triangle finally i got this video

  • @dmdeepakmittal
    @dmdeepakmittal 4 ปีที่แล้ว +5

    After searching a lot I find trigular format solution here. I implemented the same thing in scala. Appreciate your help. Thanks!

    • @nada22637
      @nada22637 3 ปีที่แล้ว

      Do you understand this equation ?

  • @luismiguelhurtadoarias2225
    @luismiguelhurtadoarias2225 ปีที่แล้ว

    Thank You i learned too much with your help.

  • @ramkrishnak6371
    @ramkrishnak6371 หลายเดือนก่อน +1

    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

  • @nizharfan
    @nizharfan 3 ปีที่แล้ว +3

    THANK YOU SIR, RESPECT! now i can do my assignment :') keep it up!

  • @sarithareddy4929
    @sarithareddy4929 3 ปีที่แล้ว +1

    Sir I can clearly understand ur teaching please explain some more topics...

  • @nadaayman8939
    @nadaayman8939 3 ปีที่แล้ว +1

    i don,t understand how the equation i-j/i+j work beacaue i and j increment at the time

  • @gschowdareddy4456
    @gschowdareddy4456 5 ปีที่แล้ว +1

    Thankyou very much for explaining

  • @blackrose0841
    @blackrose0841 4 ปีที่แล้ว

    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

  • @CSSANJAYR
    @CSSANJAYR 2 ปีที่แล้ว +2

    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?

  • @divyanshkumar5053
    @divyanshkumar5053 2 ปีที่แล้ว +1

    it works💥💥

  • @shweta7362
    @shweta7362 3 ปีที่แล้ว

    Thank you sir🙌✨

  • @rdr6858
    @rdr6858 3 ปีที่แล้ว

    Thank You Sir!

  • @importantterms9850
    @importantterms9850 2 ปีที่แล้ว

    How to generate these formula

  • @prvizpirizaditweb2324
    @prvizpirizaditweb2324 3 ปีที่แล้ว +2

    in the first iteration i and j both are zero th number should be zer
    o

    • @saini1855
      @saini1855 2 ปีที่แล้ว

      i am getting confused in this part😵‍💫😵‍💫

    • @Franky27968
      @Franky27968 10 หลายเดือนก่อน

      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

  • @bbibek1
    @bbibek1 6 ปีที่แล้ว +1

    superbbbb..SIR..

  • @SuperICHmagdich
    @SuperICHmagdich 6 ปีที่แล้ว +2

    It wont display properly when numbers get to 3 digit length but nice compact solution

  • @shahriarmim4696
    @shahriarmim4696 6 ปีที่แล้ว +1

    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.

  • @gameskingdom3224
    @gameskingdom3224 5 ปีที่แล้ว +2

    Can you do 2D array for the same example

  • @prudhvikanthbezawada2794
    @prudhvikanthbezawada2794 3 ปีที่แล้ว

    not working for 6 lines

  • @shankardsb.e5397
    @shankardsb.e5397 4 ปีที่แล้ว

    sir how to install eclipse ?

  • @AK-tt7fc
    @AK-tt7fc 2 ปีที่แล้ว

    Working

  • @amarjitdasuya
    @amarjitdasuya 6 ปีที่แล้ว +1

    thx

  • @JonathanGarcia-hc1dt
    @JonathanGarcia-hc1dt 6 ปีที่แล้ว +1

    You save me 😅😅