In a given month, N transactions related
to a bank account are passed as the input along with the initial balance IB
present in the bank account. The program must print the final balance FB in the
account after all the N transactions have been completed. Each transaction has
a code followed by the amount. The following are the possible codes and a code
is classified either as credit or debit. CASH...
Thursday, November 30, 2017
Wednesday, November 29, 2017
Same Unit Digit Adjacent Numbers
Written by Anitha Sri
on November 29, 2017
A matrix of size R*C (R rows and C
columns) containing numbers (positive integer values) is passed as input. The
program must print the count C of numbers in a given cell which has at least
one adjacent cell (in the same row) containing a number with the same unit
digit.
Input
Format:
The first line contains R and C separated
by a space. Next R lines contains C values separated by a space....
Tuesday, November 28, 2017
Only Fibonacci
Written by Anitha Sri
on November 28, 2017
N integers are passed as input. The
program must print only the integers that are present in the Fibonacci series.
Input
Format:
The first line contains N. The second line
contains N integers separated by a space.
Output
Format:
Integers that are part of the Fibonacci
series in their order of occurrence (separated by a space).
Boundary Conditions: 1 <= N <=
9999999
Example
Input/Output...
Monday, November 27, 2017
Pattern - Two Integers X & Y
Written by Anitha Sri
on November 27, 2017
Given two positive integers value X &
Y as input, print the pattern as in the Example Input/Output section.
Input
Format:
The first line contains X and Y separated
by a space.
Output
Format:
The pattern as described in the Example
Input/Output section.
Boundary
Conditions:
2 <= X, Y <= 50
Example
Input/Output 1:
Input:
10 20
Output:
11 19 12 18 13 17 14 16 15...
Sunday, November 26, 2017
Numbers - First and Last Digits Same
Written by Anitha Sri
on November 26, 2017
N numbers A(1) to A(N) are passed as
input. The program must print only the X numbers which have same first and last
digit.
Input
Format:
The first line contains N. The second line
contains N numbers separated by a space.
Output
Format:
The first line contains the X numbers
separated by a space.
Boundary
Conditions:
2 <= N <= 200
10 <= A(i) <= 9999999
1...
LRU Cache - Miss Count
Written by Sammy221
on November 26, 2017
The least recently used (LRU) cache
algorithm evicts the element from the cache that was least recently used when
the cache is full. After an element is requested from the cache, it should be
added to the cache (if not there) and considered the most recently used element
in the cache whether it is newly added or was already existing. Initially, the
cache is empty. Implement the function lruCountMiss...
Friday, November 24, 2017
Remaining Balloon Numbers
Written by Sammy221
on November 24, 2017
There are N filled balloons each painted
with a random number B(i) where i is from 1 to N and the balloons are tied up
to a rope in a straight line. M kids who play football arrive and they decide
to burst the balloons with the numbers divisible by their jersey numbers J(a)
where a is from 1 to M. The program must print the numbers on the balloons
remaining after all M kids burst the balloons in...
Wednesday, November 22, 2017
Square of Prime Closest to Sum
Written by Sammy221
on November 22, 2017
Two numbers N1, N2 are passed as input.
The program must find the closest prime number to their sum and then print the
square of that prime number. If there are multiple prime numbers which are the
closest to the sum, then the program must print -1.
Input
Format:
The first line will contain the number N1
The second line will contain the number N2
Boundary
Conditions:
1 <= N1 <= 99999999...
Tuesday, November 21, 2017
Robot No Movement Count
Written by Sammy221
on November 21, 2017
As a final year project certain student in
a college have designed a Robot which can move front, back, left or right in a
given rectangular grid of dimension L*B units (L denotes the length from left
to right and B denotes the breadth from top to bottom). Always the robot moves
in units which are of integer values. The robot cannot move outside the grid
(That is the robot cannot go beyond L and...
Palindrome Missing Alphabet
Written by Sammy221
on November 21, 2017
String S which is a palindrome is passed
as the input. But just one alphabet A is missing in S. The program must print
the missing alphabet A. Note: The FIRST alphabet of S will always be present.
Input
Format:
The first line contains S.
Output
Format:
The first line contains the missing
alphabet A.
Boundary
Conditions:
The length of the input string S is
between 3 to 100. The FIRST...
Sunday, November 19, 2017
Sliding Window Maximum
Written by Anitha Sri
on November 19, 2017
Given a list of N positive integers and a
sliding window of size W, the program must print the compare the maximum value
CURRMAX present in the specific window instance with that of the previous
window maximum PREVMAX and print the maximum value of CURRMAX and PREVMAX. The
maximum values must be separated by a space.
Input
Format:
The first line contains N and W separated
by a space....
Saturday, November 18, 2017
String - Word Counter
Written by Sammy221
on November 18, 2017
Given a string S as input which consists
of multiple words separated by a space, the program must print the count C of
the words which are repeated exactly N times. The comparison of the words is
case sensitive.
Input
Format:
The first line contains S The second line
contains N
Output
Format:
The first line contains C
Boundary
Conditions:
1 <= Length of S <= 10000
Example
Input/Output...
Array Maximum Sum Divisible By N
Written by Sammy221
on November 18, 2017
An array of numbers separated by space
will be passed as input. A number N is also passed as input. The program has to
print the maximum sum of the numbers in the array which is divisible by N. If
there is no such maximum sum of the numbers, the program should print -1 as
output.
Input
Format:
The first line contains the array of
numbers separated by space. The second line contains the value...