Live Mock Interview | Real-time DSA Session

Поделиться
HTML-код
  • Опубликовано: 8 ноя 2024

Комментарии • 26

  • @riteshgupta6438
    @riteshgupta6438 3 года назад +13

    For the first question, I thought of an O(1) solution:
    Say n = 2 and k = 3
    Now the minimum 2 digit number = 10**(n-1) = 10
    remainder = 10%3 = 1
    Ans = 10 + (k - remainder) = 10 + (3 - 1) = 10 + 2 = 12
    Take another example:
    Say n = 3 and k = 6
    Now the minimum 2 digit number = 10**(n-1) = 100
    remainder = 100%6 = 4
    Ans = 100 + (k - remainder) = 100 + (6 - 4) = 102

  • @hetsavani3591
    @hetsavani3591 Год назад +1

    Mistake in 2nd ques
    I’m else portion max statement will come first
    Then you can set current to 1

  • @410sdd
    @410sdd Год назад +2

    to find the longest sequence
    def longsub(a,n):
    Max=-1
    cur=0
    for i in range(1,n):
    if a[i-1]a[i]:
    if cur>Max:
    Max=cur
    cur=0
    return Max
    a=[1,2,3,0,5,6,1,2,3]
    n=len(a)
    print(longsub(a,n))

  • @prakritibakshi4574
    @prakritibakshi4574 3 года назад +9

    It’s great how confident he seemed!

  • @codeblooded6760
    @codeblooded6760 3 года назад +4

    15:52 If he is appending to the string n times, time complexity will be N^2 but if he is using StringBuilder like data structure in python only then time Complexity will be O(N)

  • @varungautam2595
    @varungautam2595 3 года назад +5

    the interviewer was about to give a hint and that guy interrupted in middle, pls bring more serious people from next time

  • @Code_Solver
    @Code_Solver 3 года назад +6

    We Can Learn a lot from this Mock Sessions... Thank you GFG💖

  • @410sdd
    @410sdd Год назад

    to find n digit number divisible bt k!
    def divfinder(n,k):
    x=10**(n-1)
    for i in range(x,x+20):
    if i%k==0:
    print(i)
    break
    n=int(input())
    k=int(input())
    divfinder(n,k)

  • @anmoldubey4952
    @anmoldubey4952 3 года назад +2

    I think you forgot to mention the most important part of any combinatorial question: Whether repetition of elements is allowed or not? i.e whether an element is allowed to be picked multiple times or just once from the given set of numbers to be picked which in this case is [1,2,3....9]
    Say for example if we are allowed to do that, then [1,1,9] will be a possible valid 3 digit combination summing up to 11 but the other way round, it won't be a possible combination as 1 is occurring more than once. So if that is the case then we'll have a comparatively lesser number of possible combinations like [1,2,8], [1,3,7] etc where each element is unique.

    • @dhruvbakshi9609
      @dhruvbakshi9609 3 года назад

      repetition wasnt allowed

    • @dhananjaymishra4488
      @dhananjaymishra4488 3 года назад +1

      yeah understand your point but i just wanted to check his Recursions and backtracking concept. If i wanted to check his coding abilities than i would have asked the same question with 3 4 variations. Also if You watch the interview again you will notice that i said that repetition is not allowed.
      Thank you for you feedback!
      Happy Coding!

    • @anmoldubey4952
      @anmoldubey4952 3 года назад

      @@dhananjaymishra4488 Fine :)

    • @nikhilmaurya7898
      @nikhilmaurya7898 3 года назад +1

      @@dhananjaymishra4488 In the first question I think we can answer it in O(1) like 10^n-(10^n)%k ,is it correct ?

    • @dhananjaymishra4488
      @dhananjaymishra4488 3 года назад

      @@nikhilmaurya7898 do you think that you can compute 10^n if n is let us say 25?
      and also the prev solution is also O(1) as we traversed only upto no. of digits we wanted . Hence it will br O(1) only

  • @uttammodi9417
    @uttammodi9417 2 года назад +1

    23:03 Here current will after max() function.

  • @rishabhsingh6842
    @rishabhsingh6842 3 года назад +8

    Please upload mock of serious candidates.

  • @aanchalsingh5782
    @aanchalsingh5782 3 года назад +1

    Can't I create a min n digit no which will be 1000(if n is 4) then after that i will get the mod of this no with the given k and add that mod to it wont it will give me the right answer??

  • @adityajha4373
    @adityajha4373 3 года назад

    The first question was very easy....

  • @ankitkumarmahato4318
    @ankitkumarmahato4318 3 года назад +1

    Does drop year mean after 12 a drop year?

  • @bhavishyatiwari6482
    @bhavishyatiwari6482 2 года назад +3

    for the first qsn its dammm ezz
    if n = 5
    and k = 1234
    then ans will be 12340
    if n=4 then 1234
    if n=69 then 12340000000....up to 69 digits

  • @anuzravat
    @anuzravat Год назад

    Bhakshi😭❤