Majority Element Tamil Tutorial C++ (LeetCode 169 Easy)

preview_player
Показать описание
Hey Guys! I teach competitive coding questions in Tamil:)
Any suggestions welcome:)
Thanks for watching :D

Problem Description:

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

You may assume that the array is non-empty and the majority element always exist in the array.

Example 1:

Input: [3,2,3]
Output: 3
Example 2:

Input: [2,2,1,1,1,2,2]
Output: 2
Рекомендации по теме
Комментарии
Автор

Your approach is too good. please continue akhil and create some recursion problem. Thanks a lot

gowthamc
Автор

Nalla mic la video podu na super ra irrukum

sweetdog
Автор

This solution not work with O(logn) for this input
[0, 1, 2, 2, 5, 6, 6, 7, 7, 8, 9, 9, 0, 1, 2]
Your solution provide O(n) complexity
What can we do bro?

aravindrooswelt
join shbcf.ru