[Cisco] OA 2025 start – 2 Mar (generic)

The image contains a programming question related to calculating the mean and mode of a given set of numbers in Java. Below is the extracted text from the image:


Question

The current selected programming language is Java. We emphasize the submission of a fully working code over partially correct but efficient code. Once submitted, you cannot review this problem again. You can use System.out.println() to debug your code. The System.out.println() may not work in case of syntax/runtime error. The version of JDK being used is 1.8.

Note:

The main class name must be "Solution".

The arithmetic mean of N numbers is the sum of all the numbers, divided by N.
The mode of N numbers is the most frequently occurring number.

Write an algorithm to find the mean and mode of a set of given numbers.


Input

  1. The first line of input consists of an integer - inputNum, representing the number of elements in the set (N).
  2. The next line consists of N space-separated integers representing the elements of the given set.

Output

Print K space-separated integers where:

  • The first number is the mean of the input numbers.
  • The second number is the mode (where K=2).

Note

  • If the mean calculated is in decimal, print its floor value (Floor is the greatest integer less than or equal to that number: floor(2.4) = 2).

Example

Input:

5
1 2 7 3 2

Output:

3 2

Explanation:

  • The mean for the given set of numbers is 3:
    • (1 + 2 + 7 + 3 + 2) = 15
    • 15 / 5 = 3
  • The mode is the most frequently occurring number, which is 2.

Thus, the output is 3 2.


Extracted Text from Image:


Question

Note: The main class name must be "Solution".

Ray likes puzzles. One day, he challenged Ansh with a puzzle to find a string that is the same when read forwards and backwards.

Write an algorithm to find the sub-string from the given string that is the same when read forwards and backwards.


Input

The input consists of a string - inputStr, representing the given string for the puzzle.


Output

From the given string, print a sub-string which is the same when read forwards and backwards.


Note

  • If there are multiple sub-strings of equal length, choose the lexicographically smallest one.
  • If there are multiple sub-strings of different length, choose the one with maximum length.
  • If there is no sub-string that is the same when read forwards and backwards, print "None".
  • A sub-string is only valid if its length is more than 1.
  • Strings only contain uppercase characters (A-Z).

Examples

Example 1

Input:
YABCCBAZ
Output:
ABCCBA
Explanation:

Given string is "YABCCBAZ", in this only sub-string which is same when read forward and backward is "ABCCBA".


Example 2

Input:
ABC
Output:
None
Explanation:

Given string is "ABC", and no sub-string is present which is same when read forward and backward.
So, the output is "None".


The current selected programming language is Java. We emphasize the submission of a fully working code over partially correct but efficient code. Once submitted, you cannot review this problem again. You can use System.out.println() to debug your code. The System.out.println() may not work in case of syntax/runtime error. The version of JDK being used is 1.8.

Note: The main class name must be "Solution".

Write an algorithm which finds out the elements which are largest in a row and smallest in a column in a matrix.

Input

The first line of input consists of two space-separated integers-
matrix_row and matrix_col, representing the number of rows in the matrix (N) and the number of columns in the matrix (M), respectively.

The next M lines consist of N space-separated integers representing the elements of the matrix.

Output

Print a number which is largest in a row and smallest in a column in the given matrix. If no element is found print '-1'.

Constraints

1 ≤ N, M ≤ 1000

Note

Each number in the matrix is a non-negative integer.

Example

Input:

2 2
1 2
3 4

Output:

2

Explanation:

The number 2 at index (0,1) is the largest in its row and smallest in its column.
So, the output is 2.


我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *