Skip to content

Instantly share code, notes, and snippets.

@MukulLatiyan
Created October 22, 2017 22:07
Show Gist options
  • Save MukulLatiyan/4ea5b60067904a4788507a208188046f to your computer and use it in GitHub Desktop.
Save MukulLatiyan/4ea5b60067904a4788507a208188046f to your computer and use it in GitHub Desktop.
Smaller and Larger(GeeksForGeeks)
//Java Code smaller and larger problem asked in school array section at geeksforgeeks.
import java.util.*;
import java.lang.*;
import java.io.*;
class GFG {
public static void main (String[] args) {
//code
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0){
int x = in.nextInt();
int n = in.nextInt();
int[] a = new int[x];
int first = 0;
int second = 0;
for (int i = 0; i < x; i++) {
a[i] = in.nextInt();
if (a[i] <= n) {
first ++;
}
if (a[i] >= n) {
second ++;
}
}
System.out.println(first + " " + second);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment