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)
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)
This comment has been removed by the author.
ReplyDelete