Skip to content

Conversation

mbn96
Copy link

@mbn96 mbn96 commented May 7, 2023

Removing the else clause. Looks more concise

Important

Please make sure the file name is lowercase and a duplicate file does not already exist before merging.

Removing the else clause. Looks more concise
@@ -1,12 +1,10 @@
func containsDuplicate(nums []int) bool {
nums_map := map[int]int{}
nums_map := map[int]bool{}

Choose a reason for hiding this comment

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

Suggested change
nums_map := map[int]bool{}
nums_map := map[int]struct{}{}

It may make sense to use the struct{} type here because it doesn’t occupy any memory as opposed to bool.

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.

2 participants