Summary Ranges | summary ranges | summary ranges leetcode | leetcode 228 | linear

preview_player
Показать описание




#SummaryRanges #Array #Simple #Interview #Practice #October #Leetcode #Easy #228 #Algorithm #DataStructure #Java #Preparation #NG #nickode #CookCodeTravel #CCT
Рекомендации по теме
Комментарии
Автор

Thanks! I was able to follow along with your implementation.

floatingfortress
Автор

Hello Naresh, i wrote same logic in Python but not able to get correct output

def summ_rang(a):
l1=[]
n=len(a)
i=0
start=end=0
count=0
if n==1:
return a[0]
else:
while(i<n):
start=a[i]
while(i+1<n and a[i] == a[i+1]+1):
i+=1
if start!= a[i]:
l1.append(" start + -> + end ")
else:
l1.append( "start")

return l1

kirankutte
visit shbcf.ru