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. */
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. */
Chapter8: Arrays
Section: Chapter Questions
Problem 5PE
Related questions
Question
A program in java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
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.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT