➜ ~

Playing Hacks and Stuffs!


Project maintained by h4ckyou Hosted on GitHub Pages — Theme by mattgraham

Majority Element II

image

This is the second series of the Majority Element challenge

Here’s my thought process:

1. We are given an interger array of size n, we are to find all the elements that appear more than `n/3` times
2. To solve this I'll create a hashtable which holds each element and it's corresponding number of occurrence, then I'll check if the condition is meet for each element in the hashtable

Solve Script: link

It works pretty well! image