Skip to main content

Posts

Featured

Majority Element in array with O(N) Time complexity

// { Driver Code Starts //Initial Template for C # include < stdio.h > # include < stdbool.h >   // } Driver Code Ends //User function Template for C // Function to find majority element in the array // a: input array // size: size of input array int majorityElement ( int a [] , int size) {     int count = 1 , cand = 0 ;         for ( int  i = 1 ; i < size ; i ++ ){         if (a[ cand ] == a[ i ]){             count ++ ;         }         else {             count -- ;         }         if ( count == 0 ){             cand = i ;             count = 1 ;         }     }             count = 0 ;         for ( int j = 0 ; j...

Latest Posts

HS08TEST Codechef Problem

File Handling in Cpp

getline() programm

getline() function in cpp

get() and put() function program in cpp

get() and put() function

13. Roman to integer (Use of Map(stl))

File Handling Class Assignment

Animation in Css

Transition in Css