Sparse Arrays HackerRank Solution Solved in Python

preview_player
Показать описание
This is a step by step solution to the Sparse Arrays challenge in HackerRank. We code it using Python 3

My websites

Pleas join us at International Computer Programmers here:

Feel free to connect with me

Your support can help me improve my content:
Рекомендации по теме
Комментарии
Автор

You just got to pay close attention to its description. I solved it like this: First, i iterated trough the queries list, then i checked if the querie was present in the strings lists, if it was, i would count how many times it appeared using the count() function and used the append() method to add it to a list that I created. If it wasnt present in the strings list, I would just append to my list the number 0, then I would return my list and boom problem solved

arthurregismais
Автор

The time complexity of this is N2, using hash maps you can have a time complexity of N

VipperCompany
visit shbcf.ru