Daily Leetcode Challenge | NOV 18 | HINDI | Defuse the Bomb

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 3

  • @darshankumar5546
    @darshankumar5546  5 годин тому

    if you solved this question easily, try this question: ua-cam.com/video/qPVdT2W6_rA/v-deo.html

  • @darshankumar5546
    @darshankumar5546  5 годин тому

    ENGLISH explanation: ua-cam.com/video/X41w2B9yx_s/v-deo.htmlsi=Zv7LJ2kXLv3ZEKgp

  • @darshankumar5546
    @darshankumar5546  5 годин тому

    class Solution:
    def decrypt(self, code: List[int], k: int) -> List[int]:
    n=len(code)
    if(k==0):
    return [0]*n

    modifiedNums=[]
    kk=k
    if(k0):
    ans.append(prefixSum[i+k+k]-prefixSum[i+k])
    else:
    if(i==0):
    ans.append(prefixSum[i+kk-1])
    else:
    ans.append(prefixSum[i+kk-1]-prefixSum[i+kk-1-kk])
    return ans
    # code= [5,7,1,4] k=3
    # [7, 1, 4, 5, 7, 1, 4, 5, 7, 1]
    # [7, 8, 12, 17, 24, 25, 29, 34, 41, 42]