ar7aditya / DSA-Hacktoberfest-2022

DSA
MIT License
20 stars 64 forks source link

Added two type of majority element problem , (>n/2) and (>n/3) #182

Closed subratkumar46 closed 1 year ago

subratkumar46 commented 1 year ago

181

Majority_Element _I (>n/2) :- Problem Statement: Given an array of N integers, write a program to return an element that occurs more than N/2 times in the given array. You may consider that such an element always exists in the array.

Majority_Element _II (>n/3) :- Problem Statement: Given an array of N integers. Find the elements that appear more than N/3 times in the array. If no such element exists, return an empty vector.