Someone help me to implementing my code from java to c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Someone help me to implementing my code from java to c++

https://code.sololearn.com/cf7o1837ZsNk/?ref=app

9th Jun 2020, 6:05 AM
Hawaa Basheer Ali Elamin
Hawaa Basheer Ali Elamin - avatar
1 Answer
0
- you cant have method outside class, so add majorityElement3() to Solution class, - you need main() method for test it ... return count; } //} public int majorityElement3(int[] nums) { ... } public static void main(String[] args) { int[] a = {5,7,4,6,9,2,1,8,10,3}; var sol = new Solution(); System.out.println(sol.majorityElement( a) ); System.out.println(sol.majorityElement3(a) ); } }
9th Jun 2020, 7:18 AM
zemiak