Skip to content

feat: update solutions to lc problem: No.1002 #947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2023
Merged

feat: update solutions to lc problem: No.1002 #947

merged 1 commit into from
Mar 23, 2023

Conversation

yanglbme
Copy link
Member

No.1002.Find Common Characters

No.1002.Find Common Characters
}
}
return res
return
}

func min(a, b int) int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python中的代码使用了Counter工具来对字符串进行计数,降低了代码复杂度,是一次很好的优化。Java和Go中将10000作为初始值反而增加了代码复杂度,可以参照Python的实现方式,并使用无穷大或其他足够大的数字代替这个值。在Python和Java的代码中,使用了列表推导式(list comprehension)和foreach循环,使代码更加简洁清晰;而Go的语言特性相对不支持这种方式,因此代码显得冗长,但还是能通过数据集的测试。另外,三种语言均考虑了代码可读性,采用了可读性较高的变量名和注释。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant