Input #1: Output
Input #1: Output
Input #1: Output
Given,
N=10, Where N is the number of candies available, K<=5, Where K is the
number of minimum candies that must be inside JAR ever.
Example1: (N=10,K=<5)
Input #1:
3
Output :
Number of Candies Sold: 3
Number of Candies available:7
Input #2:
4
Given a pair of positive integers m and n (m < n; 0 < m < 999; 1 < n < = 999),
write a program to smartly affix zeroes, while printing the numbers
from m to n.
Example-1
Input
5 10
Expected output
05 06 07 08 09 10
Example-2
Input
9 100
Expected output
009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026
027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044
045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062
063 064 065 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081
082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099
100
Example-3
Input
19
Problem statement:
It was one of the places, where people need to get their provisions only through
fair price (“ration”) shops. As the elder had domestic and official work to attend
to, their wards were asked to buy the items from these shops. Needless to say,
there was a long queue of boys and girls. To minimize the tedium of standing in
the serpentine queue, the kids were given mints. I went to the last boy in the
queue and asked him how many mints he has. He said that the number of mints
he has is one less than the sum of all the mints of kids standing before him in
the queue. So I went to the penultimate kid to know how many mints she has.
She said that if I add all the mints of kids before her and subtract one from it,
the result equals the mints she has. It seemed to be a uniform response from
everyone. So, I went to the boy at the head of the queue consoling myself that
he would not give the same response as others. He said, “I have four mints”.
Given the number of first kid’s mints (n) and the length (len) of the queue as
input, write a program to display the total number of mints with all the kids.
constraints:
2<n<10
1<len<20
Input#1:
42
Output:
7
Input#2:
14 4
Problem Statement:- Jaya invented a Time Machine and wants to test it by
time-traveling to visit Russia on the Day of Programmer (the 256thday of the
year) during a year in the inclusive range from 1700 to 2700. From 1700 to
1917 , Russia’s official calendar was the Julian Calendar since 1919 they used
the Gregorian calendar system. The transition from the Julian to Gregorian
calendar system occurred in 1918 , when the next day after 31 January was
February 14 . This means that in 1918, February 14 was the 32nd day of the
year in Russia. In both calendar systems, February is the only month with a
variable amount of days; it has 29 days during a leap year, and 28 days during
all other years. In the Julian calendar, leap years are divisible by 4 ; in the
Gregorian calendar, leap years are either of the following:
Divisible by 400
Divisible by 4 and not divisible by 100
Given a year, y, find the date of the 256th day of that year according to the
official Russian calendar during that year. Then print it in the format
dd.mm.yyyy, where dd is the two-digit day, mm is the two-digit month, and
yyyy is y.
Function Description
Input Format
Output Format
Print the full date of programmerday during year y in the format
dd.mm.yyyy, where dd is the two-digit day, mm is the two-digit month,
and yyyy is y.
Sample Input
2017
Sample Output
13.09.2017
Question
1. These three words will be read one at a time, in three separate line
2. The first word should be changed like all vowels should be replaced by *
3. The second word should be changed like all consonants should be
replaced by @
4. The third word should be changed like all char should be converted to
upper case
5. Then concatenate the three words and print them
For example if you print how are you then output should be h*wa@eYOU.
You can assume that input of each word will not exceed more than 5 chars
Test Cases
Case 1
Input
how
are
you
Case 2
Input
how
999
you
String Pair
Problem Description
One person hands over the list of digits to Mr. String, But Mr. String
understands only strings. Within strings also he understands only vowels. Mr.
String needs your help to find the total number of pairs which add up to a
certain digit D.
Take all digits and convert them into their textual representation
Next, sum up the number of vowels i.e. {a, e, i, o, u} from all textual
representation
Now, once digit D is known find out all unordered pairs of numbers in input
whose sum is equal to D. Refer example section for better understanding.
Constraints
1 <= N <= 100
Input
First line contains an integer N which represents number of elements to be
processed as input
Output
Lower case representation of textual representation of number of pairs in input
that sum up to digit D
Time Limit
1
Examples
Example 1
Input
12345
Output
one
Explanation
Now from given list of number {1,2,3,4,5} -> find all pairs that sum up to 9.
Upon processing this we know that only a single unordered pair {4, 5} sum up
to 9. Hence the answer is 1. However, output specification requires you to print
textual representation of number 1 which is one. Hence output is one.
Note: – Pairs {4, 5} or {5, 4} both sum up to 9. But since we are asking to count
only unordered pair, the number of unordered pair is this combination is only
one.
Example 2
Input
742
Output
zero
Explanation
3 Palindrome
Problem Description
Given an input string word, split the string into exactly 3 palindromic
substrings.
Working from left to right, choose the smallest split for the first substring that
still allows the remaining word to be split into 2 palindromes.
Similarly, choose the smallest second palindromic substring that leaves a third
palindromic substring.
If there is no way to split the word into exactly three palindromic substrings,
print “”Impossible”” (without quotes). Every character of the string needs to be
consumed.
Examples
Example 1
Input
nayannamantenet
Output
nayan
naman
tenet
Explanation
The original string can be split into 3 palindromes as mentioned in the output.
Example 2
Input
aaaaa
Output
aaa
Explanation
The other ways to split the given string into 3 palindromes are as follows –
Since we want to minimize the length of the first palindromic substring using
left to right processing, the correct way to split is [a, a, aaa].
Example 3
Input
aaaabaaaa
Output
aaabaaa
a
Explanation
The other ways to split the given string into 3 palindromes are as follows –
Since we want to minimize the length of the first palindromic substring using
left to right processing, the correct way to split is [a, aaabaaa, a].”