diff --git a/Answer15.cpp b/Answer15.cpp new file mode 100644 index 0000000..8e782dc --- /dev/null +++ b/Answer15.cpp @@ -0,0 +1,44 @@ +#include + +using namespace std; + +int main() +{ + /* + Input Format: + First line: Number of elements in array + Second line: Elements of the array + eg: + 7 + 1 2 3 3 3 1 3 + + Output Format: + Majority Element (if it exists) + "Does not exist" if majority element does not exist + */ + int n; + cin>>n; + int arr[n]; + for(int i=0 ; i>arr[i]; + } + int count[n]={0}; + for(int i=0 ; i=(n/2+1)) + { + cout<