strivedi4u / hacktoberfest2024

This repository is for beginners who want to contribution in open source Hacktoberfest 2024.This project is designed to promote learning and growth in the field of software development. It offers a range of coding challenges and projects that cover various topics, from basic algorithms to complex application development.
Apache License 2.0
11 stars 28 forks source link

Find Majority Element #45

Open Atharva-04 opened 17 hours ago

Atharva-04 commented 17 hours ago

The majorityElement function is designed to identify the majority element in a vector of integers. A majority element is defined as an element that appears more than n/2 times in the array, where n is the size of the array.

Current Implementation: The current implementation uses a map to count the frequency of each element. If an element's frequency exceeds half the size of the vector, it is returned as the majority element. If no majority element exists, the function returns -1.

genial-mani commented 15 hours ago

I want to work on this could you please assign me?