Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 8
    \$\begingroup\$ Suggested test case: [1, 1, 1, 2, 2] , so that one element is repeated more than once \$\endgroup\$ Commented Jun 6, 2018 at 11:40
  • 5
    \$\begingroup\$ "The array can have multiple types of object." Is this intended to exclude languages that do not allow arrays to have more than one type of object? \$\endgroup\$ Commented Jun 6, 2018 at 13:05
  • 2
    \$\begingroup\$ [1.0, 2, 2.0, 1.0] could be interpreted as having only one duplicate: 1.0, if one considers the integer 2 and which might be a non-integer 2.0 to be not equal. Since this is intended to allow for different types. \$\endgroup\$ Commented Jun 6, 2018 at 13:18
  • 6
    \$\begingroup\$ "standard equality function" seems hard to define, and will probably lead to different results in different languages. \$\endgroup\$ Commented Jun 6, 2018 at 13:20
  • 1
    \$\begingroup\$ Some languages have more than one equality function (for example: Java have Object.equals and ==, JS have === and ==, Python have == and is, and it's 100% opinion-based which one is more "standard"). \$\endgroup\$ Commented Jun 6, 2018 at 14:09