Day Name - 2
Given the weekday of the first day of the month, determine the day of the week of the given date in that month.
The first line is a string
The output should be a string.
In the given example,
D = Monday. As the 1st of the day of the month is a Monday, it means the 7th and 14th of the month will be Sundays (A week has 7 days). So the 16th day (N = 16) of the month will be a Tuesday.So, the output should be
Tuesday
Denominations - 3
Write a program to find the minimum number of notes required for the amount
The first line is a single integer
Given
M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be
500: 3 50: 0 10: 4 1: 3
Denominations - 4
Write a program to find the minimum number of notes required for the amount
The first line is a single integer
Given
M = 2257 Then 2257 can be written as
2000 * 1 + 500 * 0 + 200 * 1 + 50 * 1 + 20 * 0 + 5 * 1 + 2 * 1 + 1 * 0So the output should be
2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0.
Denominations - 2
The possible denominations of currency notes are 100, 50, 20 and 10. The amount
The first line of input is an integer A.
The output should be a string representing number of 100, 50, 20, 10 notes possible.
In the given example amount
370, it can be written as370 = 3*(100) + 1*(50) + 1*(20) + 0*(10)Then the output should be
IPL Match Details-
Write a program that reads all the match outcomes and summarizes the information of all the matches.
Points are given to the teams based on the outcome of the match.
A win earns a team 3 points. A draw earns 1. A loss earns 0.
The following information is expected:
MP: Matches Played
W: Matches Won
D: Matches Drawn (Tied)
L: Matches Lost
P: Points The team information should be displayed in descending order of points.
output1:
Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7
Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4
Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3
Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1
Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0input1:
6
CSK;RR;loss
RR;DD;draw
MI;KKR;win
KKR;RR;loss
CSK;DD;draw
MI;DD;draw
Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B. Input:The first line contains a single integer M.
Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A. After that next line contains a single integer N. Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.
input1:If M = 4 and for polynomial A
For power 0, co-efficient is 5
For power 1, co-efficient is 0
For power 2, co-efficient is 10
For power 3, co-efficient is 6.
If N = 3 and for polynomial B
For power 0, co-efficient is 1
For power 1, co-efficient is 2
For power 2, co-efficient is 4. outPut: addition of A and B is "6x^3 + 14x^2 + 2x + 6"
input2: output2:0
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
You are given a string. Repeat the same string N times separated by space.
Explanation
In the given example the string is messages, N = 3. So we have to repeat the string three times. Then we get messages messages messages as output.
Sample Input 1
message
3
Sample Output 1
message message message
Sample Input 2
pop
4
Sample Output 2
pop pop pop pop
Write a program that reads a single line of input and prints the first two and last two characters of the given input and prints the asterisk character (*) in place of the remaining characters.
Explanation
For example, if the given string is message, then the first two and last two characters are me, ge. Now replacing all the remaining characters with * will give the output me***ge.
Sample Input 1
Message
Sample Output 1
Me***ge
Sample Input 2
12345
Sample Output 2
12*45
How many seconds are there in 42 minutes 42 seconds