Skip to content

Instantly share code, notes, and snippets.

@talenguyen
Last active June 9, 2022 02:52
Show Gist options
  • Save talenguyen/2db671bdf16389ae63f536a929d132d5 to your computer and use it in GitHub Desktop.
Save talenguyen/2db671bdf16389ae63f536a929d132d5 to your computer and use it in GitHub Desktop.
/*
Given an array of integers, find the first repeating element in it.
We need to find the element that occurs more than once and whose index of first occurrence is smallest.
Example 1:
- Input: arr = {10, 5, 3, 4, 3, 5, 6}
- Output: 5
Example 2:
- Input: arr = {6, 10, 5, 4, 9, 120, 4, 6, 10}
- Output: 6
*/
void main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment