Yasoda went to a store to buy Ingredients to make a boul of soup.While billing the order,salesperson found that some ingredients are stale.So, he wants to separate the stale ingredients from the rest.You are given the prices of the ingredients,where a negative price value indicates a stale ingredient.Write a program to help the sales person to move the prices of all the stale ingredients to left without changing the relative order of the ingredients.
Input
The first line of input contains space-separated integers.
Explanation
In the example, there are 6 ingredients with prices 11,-12,13,-14,15,16 respectively.
The prices of the stale ingredients in the given list are -12 and -14 in the order of occurence.
So, the output is -12 -14 11 13 15 16.
Sample Input1
11 -12 13 -14 15 16
Sample Output1
-12 -14 11 13 15 16
Sample Input2
21 11 -3 -2 9
Sample Output2
-3 -2 21 11 9
Private profit maximising firms, operating within competitive markets, form the backbone of the dynamic capitalism which is capable of generating sustained and everlasting growth in standards of living in societies.”
Max Profit
You given a list of prices where prices[i] is the price of a given stock o the i th day write a program to print the maximum profit by choosing a single day to buy a stock and choosing a different day in the future to sell that stock if these is no profit that can be achieved return 0.
Input
The input is a single line containing space seperated integers.
Output
The output should be a single line integer.
Explanation
In the example the given prices are 7 1 5 3 6 4.
buying stocks on day two having price 1 and selling them on the fifth day having price 6 would give the maximum profit which is 6 - 1
so the output should be 5.
Sample Input1
1 2 1 3 6 7 4
Sample Output1
6
You are given an m*n matrix.write a program to compute the perimeter of the matrix and print the result.Perimeter of a matrix is defined as the sum of all elements of the four edges of the matrix.
Input
The first line of input containing the positive integer.
The second line of input containing the positive integer.
The next N lines of input space-separated integers.
Explanation
The input should be
3
4
1 2 3 4
5 6 7 8
9 10 11 12The output should be 1+2+3+4+8+12+11+10+9+5 = 65
Sample Input1
3
4
1 2 3 4
5 6 7 8
9 10 11 12
Sample Output1
65
Write a program to print a parallelogram pattern with * characters. The size N represents the length (the number of * characters in each line)& breadth ( the number of lines) of the parallelogram.
The slope of the parallelogram T represents the number of extra spaces a line should have in the beginning compared to its next line. The last line of the pattern does not have any spaces in the beginning.
Explanation:
Given N=3 and T=2
Each line should have 3 star(*) characters.
The last line should have 0 spaces at the beginning.
Each line has 2 extra spaces characters when compared to its next line.
Sample Input1
2
2
Sample Output1
**
**
Sample Input2
3
2
Sample Output2
***
***
***
According to one of the teachers in your school, the senior high school students sleep for 7 hours a day on a weekday. You wanted to prove this claim by making a survey of 50 senior high school students. You will be asking the students about how long they sleep in a regular weekday. Record the results of your survey. As a researcher, you need to compute the mean and standard deviation of your sample.
Create a 90%, 95%, and 99% confidence interval for the mean time of sleep for senior high school students. In your report, the raw data should be present, and the computation should be complete
In a university, there is a certain system of credits. Each of student is given a ‘credit limit’ which specifies the maximum credits of a subject they can take. A student can take any number of subjects which are under his/her credit limit.
There are N students and K subjects.Each subject has a specified number of credits .when student choose a subject ,it becomes a (student,subject)pair.
Find the maximum number of possible(subject,student)pairs for the given credit limits and subject credit requirements.
Input1:K denoting the number of subjects
Input2:An array of K elements each denoting the credits to take a subject
Input3:N denoting the number of students
Input4:An array of N elements each denoting the credit limit of a student.
Output:Your should return the maximumnumber of possible required pairs.
Example1:
Inpput1:3
Input2:{44,45,56,39,2,6,17,75}
Input3:1
Input4:{54}
Output:6
According to the Keynesian consumption function, a decrease in income will cause in savings and_______in consumption.
: Default constructor with default parameters for hours, minutes, and seconds, all set to zero. Overloaded extraction operator that prompts a user to enter the values for hours, minutes, and seconds for the Time. Continuously prompt the user if the entered value is not valid for a 24-hour clock. Overloaded insertion operator to display the Time in the form hr:min: sec. If hours, minutes, and/or seconds is a single digit, the time should be shown as 0x: where x is hours, minutes, or seconds. Example: 02:33:45, 13:05:66, 23:17:09 Overloaded prefix increment and postfix increment operators to increment the Time by one second. Overloaded subtraction operator that returns a Time object that indicates the difference between two Times. Overloaded == operator that returns true or false indicating that two Times are the same or not, respectively. Two Times are the same if they have equal values for hours, minutes, and seconds.