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

Input format:

The first line contains of 4 space separated integers. N(1<=N<=10^3), M(N-1<=M<=(N(N-1)/2).T(1<=T<=10^3) and c(1<=C<=10^3). Next m line contains two integers each. U and V denoting that there is a bidirectional road between U and V.

Output format :

Print N integers, where i th denotes the number of routes which will take the minimum amount of time required to move from city 1 to city N passing through the city i


Given a M x N matrix, write a program to print the matrix after ordering all the elements of the matrix in increasing order.Input


The first line of input will contain two space-separated integers, denoting the M and N.

The next M following lines will contain N space-separated integers, denoting the elements of each list.Output


The output should be M lines containing the ordered matrix.

Note: There is a space at the end of each line.Explanation


For example, if the given M is 3 and N is 3, read the inputs in the next three lines if the numbers given in the next three lines are the following.

3 3
1 20 3
30 10 2
5 11 15


By ordering all the elements of the matrix in increasing order, the ordered matrix should be

1 2 3
5 10 11
15 20 30


2nd example


2 5

-50 20 3 25 -20

88 17 38 72 -10


result will be

-50 -20 -10 3 17 
20 25 38 72 88 

*** import numpy should not be used


Each user has 100 credits, the user needs to input credits under 100 and the system needs to take the amount the user played and subtract that from the amount of credits the user had, then 3 numbers need to be randomly generated and the machine needs to check if the 3 numbers are the same. If it is the same the user wins double the credits than what they had and is added to the amount of credits they have. If yes to go again, if they won the credits must be added to start again but if they lost, credits must be lost.


integers = [int(number) for number in input().split()]

K = int(input())

triplets =[]

for i in range(len(integers)):

  for j in range(i+1,len(integers)):

    for k in range(j+1, len(integers)):

      a = integers[i]

      b = integers[j]

      c = integers[k]

      if a+b+c == K:

        triplets.append(tuple((a,b,c))

sorted_triplets=[]

for tripl in triplets:

  item = sorted(tripl)

  sorted_triplets.append(item)

triplets= sorted(sorted_triplets) output:[0, 8, 21] output should be like this:(0, 8, 21)

[0, 12, 17] (0, 12, 17)

[8, 9, 12] (8, 9, 12)

if len(triplets)!=0:

  for triplet in triplets:

    triplet=sorted(triplet)

    print(triplet)

else:

  print("No Matching Triplets Found")


def rotateMatrix(mat):

   if not len(mat):

    return

  top = 0

  bottom = len(mat)-1

   left = 0

  right = len(mat[0])-1

  while left < right and top < bottom:

    prev = mat[top+1][left]

    for i in range(left, right+1):

      curr = mat[top][i]

      mat[top][i] = prev

      prev = curr

     top += 1

     for i in range(top, bottom+1):

      curr = mat[i][right]

      mat[i][right] = prev

      prev = curr

     right -= 1

  output:[13, 9, 5, 1]

[14, 7, 11, 2,]

[15, 6, 10, 3]

[16 ,12, 8, 4]

output should be like this:

13, 9, 5, 1

14, 7, 11, 2

15, 6, 10, 2

16, 12, 8,


You are required to develop a Multiple Document Interface application for the following scenario:

An MDI consists of a main window with a menu bar, toolbar and central workspace widget. You are required to develop a basic tourism event management application for your community that displays information of events,venues and bookings(reservation).Dates and start times are required for the events.Venue capacity, address and contact detail of event manager must be recorded for each venue.Client information in terms of name, and contact details must also be managed by your program.Store all your data in text files.

Make use of at least of the following widget.

QMenubar

QFileDialog

Any widgets used to date that may be usefull


Rearrange Numbers in String

Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.

Input

The input will be a single line containing a string.

Output

The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.

Explanation

For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".

Sample Input

I am 5 years and 11 months old

Sample Output

I am 11 years and 5 months old




You are given a square matrix A of dimensions NxN. You need to apply the below given 3 operations on the matrix A.


Given a sentence as input, find all the unique combinations of two words and print the word combinations that are not adjacent in the original sentence in lexicographical order

For example, if the given sentence is "python is a programming language", the possible unique combination of two are (a, is), (a, language), (a, programming), (a, python), (is, language), (is, programming), (is, python), (language, programming), (language, python), (programming, python). Out of these the combinations, (a, is), (a, programming), (is, python), (language, programming) are not valid as they contain words that are adjacent in the given sentence. So the output should be

a language

a python

is language

is programming

language python

programming python

input: input:

raju always plays cricket to be or not be

output: output:

always cricket be be

cricket raju be not

plays raju or to

to to

it should satisfy both inputs and hidden testcases?

so,can anyone make code for this?


Given a range represented by two positive integers L and R. Find the number lying in the range having the maximum product of the digits. (Inclusive of L and R).

For example, if the given T is 2, read the L and R of the first test case in the next line. If the given L and R are 1 and 10 respectively. As 9 is the maximum product of digits, so the output for the first test case is 9.

If the L and R are 15 to 30 respectively. The product of the digits of number 29 is 18. As 18 is the maximum product in the range, so the output should be 18.

input:

2 1

1 10

15 30

output:

9

29


LATEST TUTORIALS
APPROVED BY CLIENTS