Created
October 22, 2017 22:07
-
-
Save MukulLatiyan/4ea5b60067904a4788507a208188046f to your computer and use it in GitHub Desktop.
Smaller and Larger(GeeksForGeeks)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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