• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 04, 2022 |17.4K Views
First element to occur k times | SDE Sheet | Hashing
  Share  2 Likes
Description
Discussion

In this video we will see how to find the first element that occurs k number of times in a given array of n integers. If no such element found then print -1. Examples: Input: {1, 7, 4, 3, 4, 8, 7}, k = 2 Output: 7 Both 7 and 4 occur 2 times. But 7 is the first element that occurs 2 times. Check out the video to see how we implement this!! Practice Problem: https://practice.geeksforgeeks.org/problems/first-element-to-occur-k-times5150/1 Article: https://www.geeksforgeeks.org/first-element-occurring-k-times-array/ SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More