105 - Sparse Arrays | Arrays | Hackerrank Solution | Python

preview_player
Показать описание
⭐️ Content Description ⭐️
In this video, I have explained on how to solve sparse arrays using dictionary in python. This hackerrank problem is a part of Problem Solving | Practice | Data Structures | Arrays | Sparse Arrays and solved in python. The complexity of this solution is O (n).

Make a small donation to support the channel 🙏🙏🙏:-

#sparsearrays #howtosolve #hackerrank #hackerranksolutions #hackersrealm #python #arrays #problemsolving #tutorial #algorithms #datastructures #programming #coding #codinginterview #education #aswin
Рекомендации по теме
Комментарии
Автор

I did like that and i think the time complexity is O(n)
count = dict(zip(queries, [0] * len(queries)))
for stri in stringList:
if stri in count:
count[stri] += 1
return list(count.values())

abdelalim
Автор

I did mine like this and got and it passed the samples. Is the way i did it wrong?

a = []


        a.append(x)

    return a

onochieifedebe
visit shbcf.ru