Count Of Smaller Elements Geeks For Geeks

 class Compute {

    

    public long countOfElements(long arr[], long n, long x)

    {

        long count=0l;

        for(int i=0;i<n;i++){

            if(arr[i]<=x){

                count++;

            }

        }

        return count;

    }

}


TIME:O(N)[GFG Time: 0.7/3.5]

SPACE:O(1)

Comments

Post a Comment

Popular posts from this blog

Solutions Of Practice Questions Dated 01-06-2022

CODEFORCES SPY DETECTED ROUND 713

Maximum Winning Score Geeks For Geeks