The above code is not executive and its somewhere mistaken
Write a function that takes an array A and reduces it to row echelon form, returning the modified array A. To do this, iterate over each row. Find the first non-zero column. Perform row operations so that (a) this first non-zero entry is set to one, and (b) all entries in this column but in rows with larger index are set to zero.
String Concatenation
Disha has three strings A, B, and C consisting of lowercase letters.She also has a string T consisting only of characters 1, 2 and 3.
She wants to concatenate the three strings according to the characters in T.
Your task is to print the final output string.
Note: Formally, follow the below instructions:
* For each integer i such that 1<=i<=|T|, let the string si be defined as follows:
*Concatenate the strings s1,s2,...,s|T| in this order and print the resulting string.
Sample Input1
mari
to
zzo
1321
Sample Output1
marizzotomari
Unique Matrix
You are given a N*N matrix. write a program to check if the matrix is unique or not. A unique Matrix is a matrix if every row and column of the matrix contains all the integers from 1 to N
Input
The first line contains an integer N.
The next N lines contains N space separated values of the matrix.
Output:
The output contains a single line and should be True if the matrix is unique matrix and False otherwise.
Sample input:
4
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
Sample output:
True
Sample Input2
4
1 2 3 3
2 3 4 1
3 4 1 2
4 1 2 3
Sample Output
False
Scoring
A group of people(P) are playing an online game. Their scores are stored in the order of their entry time in S. Each integer S[i] corresponds to the score of the person Pi.
For each person Pi you have to report the number of people who played after the person and scored less than the person.
Input
The first line contains a single integer N.
The second line contains N space-separated
Output
The output should contain N space-separated integers representing the number of people who played after the person and scored less than the person.
Explanation
Given S = 13 12 11 Score of P1 is 13. Score of P2 is 12. Score of P3 is 11.The number of people who played after P1 and scored less than 13 is 2(12, 11). The number of people who played after P2 and scored less than 12 is 1(11). The number of people who played after P3 and scored less than 11 is 0.The output is 2 1 0.
Sample Input 1
3
13 12 11
Sample Output 1
2 1 0
Sample Input 2
4
4 3 5 2
Sample Output 2
2 1 1 0
Game
There are N people in a party numbered 1 to N. Sruthi has K cards with her. Starting with person A, she gives the cards one by one to the people in the party in the numbering order: A, A+1, A+2, . .., N, 1, 2,..., A-1. Your task is to output the number of the person who will get the last card.
Input
The only line of input contains space separated integers N, K and A.
Output
print the number representing the person who will get the last card.
Explanation
Given N=3, K=3 and A=2.
Distribution of cards starts from 2. The final order of person is 2,3,1.
The last person to get the card is 1.
Sample Input1
3 3 2
Sample Output1
1
Sample Input 2
1 100 1
Sample Output2
1
Pattern Printing
Given the number of rows N, write a program to print the hallow diamond pattern similar to the pattern shown below.
A
B B
C C
D D
E E
D D
C C
B B
A
Input
The input will be a single line containing a positive integer (N).
Output
The output should be (2*N - 1) rows and (2*N - 1) columns containing the alphabet characters in the hollow diamond pattern.
Explanation
For example, if the given number is 5, the pattern should contain 9 rows and 9 columns as shown below.
A
B B
C C
D D
E E
D D
C C
B B
A
NOTE:
NO SPACES ON LEFT SIDE FOR DIAMOND
Riya took part in a maths quiz competition. To win the prize money she has to solve a tricky question at the end.For a given list of integers, write a program where all the integers in a given index range to be added.
She will be given M multiple ranges, where she should print the sum of numbers for each corresponding range.
Note: The limits in the range are both inclusive.
Input
The first line f input is space-separated integers.
The second line of input is a positive integer M denoting the number of index ranges.
The next M lines contain two space-separated integers of the range.
Output
The output should be M lines.
Each line contains an integer that represents the sum for the corresponding ranges.
Sample Input1
1 3 4 5 6
5
3 5
Sample Output1
12
[Please test the sample test cases and send the screenshots].
Mode
given a list of integers,write a program to print the mode.
mode - the most common value in the list. if multiple elements with same frequency are present, print all values with same frequency in increasing order.
input
the input will be a single line of containing space-separated integers.
output
the third line of output should contain the mode.
see sample input/output for the output format
explanation
for example, if the given list of integers are
2 6 3 1 8 12 2 9 10 3 4
the average of all the numbers is 4.67.
after sorting the array,
1 2 2 3 3 4 6 8 9 10 12
as 2 and 3 are having the same frequency , the mode will be 2 3.
so the output should be
Mode: 2 3
sample input 1
2 6 3 1 8 12 2 9 10 3 4
sample output 1
Mode: 2 3
Mode
given a list of integers,write a program to print the mode.
mode - the most common value in the list. if multiple elements with same frequency are present, print all values with same frequency in increasing order.
input
the input will be a single line of containing space-separated integers.
output
the third line of output should contain the mode.
see sample input/output for the output format
explanation
for example, if the given list of integers are
2 4 5 6 7 8 2 4 5 2 3 8
the average of all the numbers is 4.67.
after sorting the array,
2 2 2 3 4 4 5 6 7 8 8
as 2 is most repeated number , the mode will be 2.
so the output should be
Mode: 2
sample input 1
2 4 5 6 7 8 2 4 5 2 3 8
sample output 1
Mode: 2