Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Given

N = 10From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.

So the output should be 9 + 2 =

11.

Sample Input 1

10

Sample Output 1

11

Sample Input 2

4

Sample Output

4


In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other
two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message
indicating whether the triangle is a right triangle.

Write a program to print the anti-diagonal elements in the given matrix.

Input

The first line of input will contain an integer N, denoting the number of rows and columns of the input matrix.

The next N following lines will contain N space-separated integers, denoting the elements of each row of the matrix.

Output

The output should be a list containing the anti-diagonal elements.

Explanation

For example, if the given N is 3, and the given matrix is

1 2 3

4 5 6

7 8 9

The anti diagonal elements of the above matrix are 3, 5, 7. So the output should be the list

[3, 5, 7]

Sample Input 1

3

1 2 3

4 5 6

7 8 9

Sample Output 1

[3, 5, 7]

Sample Input 2

5

44 71 46 2 15

97 21 41 69 18

78 62 77 46 63

16 92 86 21 52

71 90 86 17 96

Sample Output 2

[15, 69, 77, 92, 71]


Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.

Input


The input will contain space-separated integers, denoting the elements of the list.

Output


The output should be an integer.

Explanation


For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,


[2]

[2, -4]

[2, -4, 5]

[2, -4, 5, -1]

[2, -4, 5, -1, 2]

[-4]

[-4, 5]

[-4, 5, -1]

[-4, 5, -1, 2]

[5]

[5, -1]

[5, -1, 2]

[-1]

[-1, 2]

[2]

Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.

Sample Input 1

2 -4 5 -1 2 -3

Sample Output 1

6


Sample Input 2

-2 -3 4 -1 -2 1 5 -3

Sample Output 2

7




Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.

Input


The input will contain space-separated integers, denoting the elements of the list.

Output


The output should be an integer.

Explanation


For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,


[2]

[2, -4]

[2, -4, 5]

[2, -4, 5, -1]

[2, -4, 5, -1, 2]

[-4]

[-4, 5]

[-4, 5, -1]

[-4, 5, -1, 2]

[5]

[5, -1]

[5, -1, 2]

[-1]

[-1, 2]

[2]

Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.

Sample Input 1

2 -4 5 -1 2 -3

Sample Output 1

6


Sample Input 2

-2 -3 4 -1 -2 1 5 -3

Sample Output 2

7




Compare last three characters
Explanation given strings are apple,pimple in both the strings the last three characters ple are comman

CS Python Fundamentals Assignment 1: Silly Sentences


Give an example of a nested conditional that can be modified to become a single conditional and show the equivalent single conditional

Give a strategy for avoiding nested conditionals .


You are given a square matrix of size NxN, write a program to print the sum of upper and lower triangular elements.
Upper triangle consists of elements on the anti-diagonal and above it. The lower triangle consists of elements on the anti-diagonal and below it.

Explanation:
In the example,if the given matrix is

1 2 3
4 5 6
7 8 9

The upper triangle consists of elements on the anti-diagonal and above on it.

1 2 3
4 5
7

The sum of upper triangle elements is (1+2+3+4+5+7) equal to 22.
The lower triangle consists of elements on the anti-diagonal and below to it.

3
5 6
7 8 9

The sum of lower triangle elements is (3+5+6+7+8+9) equal to 38.

So the output should be

22
38
LATEST TUTORIALS
APPROVED BY CLIENTS