LeetCode题解(0760):找出变位映射(Python)
发布日期:2021-06-29 20:09:33 浏览次数:3 分类:技术文章

本文共 344 字,大约阅读时间需要 1 分钟。

题目:(简单)

标签:哈希表

解法 时间复杂度 空间复杂度 执行用时
Ans 1 (Python) O ( A + B ) O(A+B) O(A+B) O ( B ) O(B) O(B) 36ms (99.17%)
Ans 2 (Python)
Ans 3 (Python)

解法一:

class Solution:    def anagramMappings(self, A: List[int], B: List[int]) -> List[int]:        count = {
} for i, n in enumerate(B): count[n] = i return [count[n] for n in A]

转载地址:https://dataartist.blog.csdn.net/article/details/109838850 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:LeetCode题解(0781):森林中的兔子(Python)
下一篇:LeetCode题解(0734):句子相似性(Python)

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月05日 16时06分43秒