You are given a list of integers. You are then given a second list of integers. For each value in the second list, count the number of values in the first list that are greater. Display your result for each value in the second list. Input Format First line is a single value. This is the number of integers in the first list. Second line is the list of values. Third line is the list of values that for each one you will count how many value of the first list are larger. Constraints All values given are integers > 0 The list will not contain greater than 100,001 values The list of values to use in your search will not be greater than 100,001 Neither given list will necessarily be sorted. Output Format For each value in the second list, output the count of values in the first list that are larger. Sample Input 0 5 34 43 16 21 14 14 24 Sample Output 0 4 Explanation 0 There are four values greater than 14 in the original list of five: 34, 43, 16, and 21 There are only two values greater than 24 in the original list of five: 34 and 43. So we output 4 and then 2 1 import java.io.*; 2 import java.util.*; 3 import java.text.*; 4 import java.math. *; 5 import java.util.regex.*; public class Solution { 6 7 8 9▾ 10 ▾ 11 Java 7 public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output t be named Solution. */

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

A program in java 

You are given a list of integers.
You are then given a second list of integers.
For each value in the second list, count the number of values in the first list that are
greater.
Display your result for each value in the second list.
Input Format
First line is a single value. This is the number of integers in the first list.
Second line is the list of values.
Third line is the list of values that for each one you will count how many value of the first
list are larger.
Constraints
All values given are integers > 0
The list will not contain greater than 100,001 values The list of values to use in your search
will not be greater than 100,001
Neither given list will necessarily be sorted.
Output Format
For each value in the second list, output the count of values in the first list that are larger.
Sample Input 0
5
34 43 16 21 14
14 24
Sample Output 0
4
2
Explanation 0
There are four values greater than 14 in the original list of five: 34, 43, 16, and 21
There are only two values greater than 24 in the original list of five: 34 and 43.
So we output 4 and then 2
1 import java.io.*;
2 import java.util.*;
3 import java.text.*;
4 import java.math. *;
5 import java.util.regex. *;
6
7 public class Solution {
8
9 ▾
10-
Java 7
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to
be named Solution. */
}
11
12 }
Transcribed Image Text:You are given a list of integers. You are then given a second list of integers. For each value in the second list, count the number of values in the first list that are greater. Display your result for each value in the second list. Input Format First line is a single value. This is the number of integers in the first list. Second line is the list of values. Third line is the list of values that for each one you will count how many value of the first list are larger. Constraints All values given are integers > 0 The list will not contain greater than 100,001 values The list of values to use in your search will not be greater than 100,001 Neither given list will necessarily be sorted. Output Format For each value in the second list, output the count of values in the first list that are larger. Sample Input 0 5 34 43 16 21 14 14 24 Sample Output 0 4 2 Explanation 0 There are four values greater than 14 in the original list of five: 34, 43, 16, and 21 There are only two values greater than 24 in the original list of five: 34 and 43. So we output 4 and then 2 1 import java.io.*; 2 import java.util.*; 3 import java.text.*; 4 import java.math. *; 5 import java.util.regex. *; 6 7 public class Solution { 8 9 ▾ 10- Java 7 public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to be named Solution. */ } 11 12 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Map
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT