substring:
you are given two strings N &K your goal is to determine the smallest substring of N that contains all the characters in K If no substring present in N print No matches found
note: if a character is repeated multiple time in K your substring should also contain that character repeated the same no.of times
i/p:the 1st line input two strings N&K
input:
stealen lent
o/p:
tealen
i/p:
tomato tomatho
no matches found
Discount sale:
it is a summer discount sale in mumbai and all the local shops have put up various offers Arjun selected N items to buy while standing in the building queue,he noticed the offer "buy two !" get two FREE!".this means that for every two items he buys they give him two items for free however ,items can be of varying prices they always charge for two most costly items and give the other two as free.Arjun is confused with grouping his items to reduce the total price he has to pay your task is to find the minimum price arjun has to pay to buy all the N items
input:the 1st line contains a single integer N
the 2nd line has N space-separated integers representing the cost of items
input:
4
1 1 2 2
o/p:4
i/p:
2
10 200
output:
210
candies:
Rose bought 3 boxes of candies each box contains candies only of one specific flavor
box1:blue raspberry flavor
box2:butterscotch flavor
box3:cherry flavor
each day rose eats exactly two candies flavor(she won't eat two candies of the same flavor in a day)she won't eat more than 2 candies or 1 candy in a day .your task is to find the maximum number of days rose can keep eating candies.
input:
the 1st line input contains 3 space-separated integers A,B,C denoting the no.of blue raspberry, butterscatch and cherry candies respectively
input: 1 1 1
output:1
i/p:1 2 1
o/p:2
Write a program to print the following,
Input
The first line contains a string representing a scrambled word.
The second line contains some space-separated strings representing words guessed by the player.
Output
The output should be a single integer of the final score.
Explanation
scramble word = "tacren"
guessed words = ["trance", "recant"]
Since "trance" and "recant" both have length 6 then you score 54 pts each.
So the output is 108.
Sample Input1
tacren
trance recant
Sample Output1
108
Number of moves:
you are given a nxn square chessboard with one bishop and k number of obstacles placed on it. A bishop can go to different places in a single move. find the total no.of places that are possible for the bishop in a single move. Each square is referenced by a type describing the row, R, and column, C, where the square is located.
explanation: given N=6 K=2
bishop position 5 2
obstacle positions (2 2), (1 5)
the bishop can move in so o/p is 6
I/p:
6 2
5 2
2 2
1 6
O/p:
6
I/p:
6 4
3 3
1 3
3 1
5 1
1 5
O/p: 7
2. Plot these data as electromagnetic waves on a graph and find the following:
a. Period
b. Frequency
2.1 Time= 15s
Cycles= 5
2.2 Time= 30s
Cycles= 6s
3. The wavelength of an electromagnetic wave is 450nm, and the speed of light (c) is 3x108m/s. Determine the frequency, energy, and numbers of the electron.
1. Plot these data as electromagnetic waves on a graph and find the following:
a. Wavelength
b. Amplitude
1.1 Highest position (y)= 12m
Lowest position (y)= -4m
Cycles= 6
Distance (x) = 32m
1.2 Highest position (y)= 15m
Lowest position (y)= -3m
Cycles= 4
Distance (x) = 25m
The mechanical power output of a cyclist moving at a constant speed of 5.90 m/s on a level road is 107 W.
What is the force exerted on the cyclist and the bicycle by the air?
A. The following are the heights of four students in centimeters. Suppose
samples of size 2 are taken from this population of four students.
STUDENTS | HEIGHT(in cm)
Cardo 125
Alyana 120
Joaquin 130
Flora 110
a. Compute the mean of the population
b. Compute the mean of the sampling distribution of the sample means
A random sample of 60 Grade 11 students’ ages is obtained to estimate the mean ages of all Grade 11 students. Suppose the sample mean is 17.3 and the population variance is 18,