top of page

Looking to master object-oriented and system design for tech interviews or career growth?

  • Improve your system design and machine coding skills.

  • Study with our helpful resources.

  • Prepare for technical interviews and advance your career.

**We're in beta mode and would love to hear your feedback.

Writer's pictureilluminati

N/3 Repeat Number Interviewbit Solution


Problem Description:

You’re given a read only array of n integers. Find out if any integer occurs more than n/3 times in the array in linear time and constant additional space.

If so, return the integer. If not, return -1.

If there are multiple solutions, return any one.


Example :

Input : [1 2 3 1 1] 
Output : 1  
1 occurs 3 times which is more than 5/3 times. 

Solution:


Comments


bottom of page