Professional Documents
Culture Documents
Input Format:
Input contains an integer 'N' denoting the number
Output Format:
If the number whose square ends with the number itself, print
"Correct Number", otherwise print "Incorrect Number".
If the user enters negative integer, the result should display
"Wrong Input".
Constraints:
1 <= N<=10^8
Sample Input 1:
25
Sample Output 1:
Correct Number
Sample Input 2:
-6
Sample Output 2:
Wrong Number
1.
2.
3.
4.
Problem Statement:
Form a number system with only 3 and 4. Find the nth number of the number system.
Eg.) The numbers are: 3, 4, 33, 34, 43, 44, 333, 334, 343, 344, 433, 434, 443, 444, 3333, 3334,
3343, 3344, 3433, 3434, 3443, 3444 ....
Input Format:
Input will be an integer
Output Format:
Print the nth number
Constraints:
1<=N<=10000000
Sample Input 1:
8
Sample Output 1:
334
Sample Input 2:
6743
Sample Output 2:
434334344333
1.
2.
3.
4.
Problem Statement:
range is 0-999
Constraints:
N/A
Sample Input 1:
234
Sample Output 1:
two hundred and thirty four
Sample Input 2:
200
Sample Output 2:
two hundred only
Sample Input 3:
12
Sample Output 3:
twelve
Mr. Jason has captured your friend and has a collar around his
neck. He has locked the collar with a given “locking key". Now it can
only be opened with an “unlocking key”. Your friend sees the
locking key but he does not know how to find unlocking key.You
can calculate the unlocking key if you have the locking key,
because the unlocking key will be the smallest (in magnitude)
permutation of the digits of the locking key and will never start with
zero. Help your friend write an algorithm that outputs the unlocking
key by taking key as an input.
Input Format:
The input to the function/method consists of an argument
lockingkey, an integer representing the locking key.
Output Format:
Return an integer representing the unlocking key
Constraints:
-10^7 <= lockingkeys <= 10^7
Sample Input :
62154
Sample Output :
12456
Input Format:
Input contains the size and the values
Output Format:
Print the required output as number - count
Constraints:
1<=size<=1000
Sample Input :
512341
Sample Output :
1-22-13-14-1
Problem Statement:
A war is happening. The enemy battalion has planted a bomb in
your bunker. Your spy has intercepted a message from the enemy.
It contains a list with N numbers and a key (K). The numbers are
used to construct a sequence that will defuse the bomb.
According to your spy, the logic to extract the sequence from the
message is to replace each number with the sum of the next K
numbers, if the value of K is positive. If the value of K is negative,
the number is replaced by the sum of the previous K numbers. The
series of numbers is considered in a cyclic fashion for the last K
numbers.
Write an algorithm to find the sequence that will defuse the bomb
#include<stdio.h>
#include<stdlib.h>
int* defuseBomb(int *arr,int n,int k)
{
//write your code
}
int main()
{
int n,*arr,index,*res,k;
scanf("%d",&n);
arr=(int *)malloc(sizeof(int)*n);
scanf("%d",&k);
for(index=0;index<n;index++)
scanf("%d",&arr[index]);
res=defuseBomb(arr,n,k);
for(index=0;index<n;index++)
printf("%d ",res[index]);
return 0;
}
Input Format:
The input to the function/method consists of three arguments;
size, an integer representing the size of the list (N);
key, an integer representing the key (K);
message, representing the list of integers.
Output Format:
Return a list of integers representing the sequence that will defuse
the bomb
Constraints:
0 < size <= 10^5
-10^6 <= message[i] <= 10^6
0 <= i < size
Sample Input :
4 3 4 2 -5 11
Sample Output :
8 10 17 1