I am using a recursive code as below:
def dfs(self, hash_map):
ans = 1
for key,value in hash_map.items():
if value > 0:
hash_map[key] = hash_map[key] - 1
ans = ans + self.dfs(hash_map)
hash_map[key] = value
return ans
So will the list returned by items() method in the dictionary retain the order?