Skip to content

Instantly share code, notes, and snippets.

@iamgoangle
Created August 1, 2022 04:32
Show Gist options
  • Select an option

  • Save iamgoangle/cc331881bd24158d241e3d0fb50ee9b2 to your computer and use it in GitHub Desktop.

Select an option

Save iamgoangle/cc331881bd24158d241e3d0fb50ee9b2 to your computer and use it in GitHub Desktop.
Find repeatable number

Given an array that have duplicated member

[9, 8, 2, 6, 1, 8, 5, 3, 4, 7]

You should find the repeat number and share the output like this.

{ 
  '1': 1,
  '2': 1,
  '3': 1,
  '4': 1,
  '5': 1,
  '6': 1,
  '7': 1,
  '8': 2,
  '9': 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment