Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NEED SOLUTION IN JAVA OR PYTHON ONLY. You are given strings S and C. String S represents a table in CSV (comma-separated values) format, where
NEED SOLUTION IN JAVA OR PYTHON ONLY.
You are given strings S and C. String S represents a table in CSV (comma-separated values) format, where rows are separated by new line characters (' ') and each row consists of one or more fields separated by commas (','). The first row contains the names of the columns. The following rows contain values. For example, the table below is presented by the following string: S= "id,name,age,act.,room,dep. ln1,Jack,68,T,13,8 17,Betty,28,F,15,7". String C is the name of a column in the table described by S that contains only integers. Your task is to find the maximum value in that column. In the example above, for C= "age", the maximum value is 68 . Write a function: def solution(S,C) which, given two strings S and C consisting of N and M characters, respectively, returns the maximum value in column C of the table described by S. Examples: 1. Given S= "id,name,age,act.,room,dep. ln1,Jack,68, T,13,8 17, Betty, 28, F,15,7 " and C= "age", your function should return 68 since 68 is the maximum of 68 and 28. 2. Given S= "area,land \3722,CN 6612,RU 3855,CA 3797,USA " and C= "area", your function should return 6612. "temp", your function should return 2. Assume that: - S is a string of length N in CSV format; - N is an integer within the range [3..100,000]; - M is an integer within the range [1..5]; - there are at least two rows; - each row has the same, positive number of cells; - each cell is of length [1..5] and consists only of letters, digits and/or special characters: ' . -'; - C is the name of a unique column in the table, whose values are integers within the range [-9999..9999]; there are no erroneous values in this column; - there is no new line at the end of string S. In your solution, focus on correctness. The performance of your solution will not be the focus of the assessmentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started