Instruction stringlengths 261 35k | Response stringclasses 1
value |
|---|---|
For this Question: Santa has been trying to solve the following task. Would you please help him so that he can go back to distributing gifts?
Given an integer N, print "AC" if N is 1. Otherwise, print "WA".
Note: You are supposed to print "AC" and "WA" without the quotes.The input consists of a single line contai... | Compilable |
For this Question: Santa has been trying to solve the following task. Would you please help him so that he can go back to distributing gifts?
Given an integer N, print "AC" if N is 1. Otherwise, print "WA".
Note: You are supposed to print "AC" and "WA" without the quotes.The input consists of a single line contai... | Compilable |
For this Question: Santa has been trying to solve the following task. Would you please help him so that he can go back to distributing gifts?
Given an integer N, print "AC" if N is 1. Otherwise, print "WA".
Note: You are supposed to print "AC" and "WA" without the quotes.The input consists of a single line contai... | Compilable |
For this Question: Create 6 variables with names<code>varA, varB, varC, varD, varE, varF</code>
Store 6 different values of your choice in the variables such that the variables represent the given primitive types in the given order:
<code>varA</code>: Number
<code>varB</code>: String
<code>varC</code>: Boolean
<co... | Compilable |
For this Question: You are given an array A of size N. You have to print the maximum in every <b>K-sized subarray</b> from the left to the right in the array A.
More formally, you have to print N - K + 1 integers X<sub>1</sub>, X<sub>2</sub>, ..., X<sub>N-K+1</sub> such that X<sub>i</sub> (1 <= i <= N - K + 1) is the ... | Compilable |
For this Question: You are given an array A of size N. You have to print the maximum in every <b>K-sized subarray</b> from the left to the right in the array A.
More formally, you have to print N - K + 1 integers X<sub>1</sub>, X<sub>2</sub>, ..., X<sub>N-K+1</sub> such that X<sub>i</sub> (1 <= i <= N - K + 1) is the ... | Compilable |
For this Question: You are given an array A of size N. You have to print the maximum in every <b>K-sized subarray</b> from the left to the right in the array A.
More formally, you have to print N - K + 1 integers X<sub>1</sub>, X<sub>2</sub>, ..., X<sub>N-K+1</sub> such that X<sub>i</sub> (1 <= i <= N - K + 1) is the ... | Compilable |
For this Question: Given a string S consisting of characters 'A' or 'B' only, you need to find the maximum length of substring consisting of character 'A' only.The first and the only line of input contains the string S.
Constraints
1 <= |S| <= 100000
S consists of characters 'A' or 'B' only.Output a single integer... | Compilable |
For this Question: Given a string S consisting of characters 'A' or 'B' only, you need to find the maximum length of substring consisting of character 'A' only.The first and the only line of input contains the string S.
Constraints
1 <= |S| <= 100000
S consists of characters 'A' or 'B' only.Output a single integer... | Compilable |
For this Question: Given a string S consisting of characters 'A' or 'B' only, you need to find the maximum length of substring consisting of character 'A' only.The first and the only line of input contains the string S.
Constraints
1 <= |S| <= 100000
S consists of characters 'A' or 'B' only.Output a single integer... | Compilable |
For this Question: Given a boolean matrix of size N*M in which each row is sorted your task is to print the index of the row containing maximum 1's. If multiple answer exist print the smallest one.First line contains two space separated integers denoting values of N and M. Next N lines contains M space separated intege... | Compilable |
For this Question: Given a boolean matrix of size N*M in which each row is sorted your task is to print the index of the row containing maximum 1's. If multiple answer exist print the smallest one.First line contains two space separated integers denoting values of N and M. Next N lines contains M space separated intege... | Compilable |
For this Question: Given a boolean matrix of size N*M in which each row is sorted your task is to print the index of the row containing maximum 1's. If multiple answer exist print the smallest one.First line contains two space separated integers denoting values of N and M. Next N lines contains M space separated intege... | Compilable |
For this Question: Given a boolean matrix of size N*M in which each row is sorted your task is to print the index of the row containing maximum 1's. If multiple answer exist print the smallest one.First line contains two space separated integers denoting values of N and M. Next N lines contains M space separated intege... | Compilable |
For this Question: Given an integer N, your task is to print all the even integer from 1 to N.<b>User task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the functions <b>For_Loop()</b> that takes the integer n as a parameter.
</b>Constraints:</b>
1 <= N <= 10... | Compilable |
For this Question: Sara loves problems on permutation but this time she stuck on a problem and asks for your help.
Given a permutation of N integers as Arr[], your task is to check for each K(1 <= K <= N) there exists a subarray of size K such that it is also a permutation of K integers.
Note:- A permutation of N i... | Compilable |
For this Question: Sara loves problems on permutation but this time she stuck on a problem and asks for your help.
Given a permutation of N integers as Arr[], your task is to check for each K(1 <= K <= N) there exists a subarray of size K such that it is also a permutation of K integers.
Note:- A permutation of N i... | Compilable |
For this Question: Sara loves problems on permutation but this time she stuck on a problem and asks for your help.
Given a permutation of N integers as Arr[], your task is to check for each K(1 <= K <= N) there exists a subarray of size K such that it is also a permutation of K integers.
Note:- A permutation of N i... | Compilable |
For this Question: You will be given an array of several arrays that each contain integers and your goal is to write a function that
will sum up all the numbers in all the arrays. For example, if the input is [[3, 2], [1], [4, 12]] then your
program should output 22 because 3 + 2 + 1 + 4 + 12 = 22An array containing ... | Compilable |
For this Question: Given a linked list consisting of N nodes, your task is to traverse the list and print its elements.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>printList()</b> that takes head node of the linked list as parameter.... | Compilable |
For this Question: Siddharth, a great entrepreneur, chooses a person as an intern if he/she good at maths. Thus Sid gives a simple maths problem to the candidate based on which he decides to who is gonna get the offer. Below is the description of the problem asked by Sid
Given arr <b>A[]</b> containing <b>N</b> positi... | Compilable |
For this Question: Siddharth, a great entrepreneur, chooses a person as an intern if he/she good at maths. Thus Sid gives a simple maths problem to the candidate based on which he decides to who is gonna get the offer. Below is the description of the problem asked by Sid
Given arr <b>A[]</b> containing <b>N</b> positi... | Compilable |
For this Question: Siddharth, a great entrepreneur, chooses a person as an intern if he/she good at maths. Thus Sid gives a simple maths problem to the candidate based on which he decides to who is gonna get the offer. Below is the description of the problem asked by Sid
Given arr <b>A[]</b> containing <b>N</b> positi... | Compilable |
For this Question: Create 6 variables with names<code>varA, varB, varC, varD, varE, varF</code>
Store 6 different values of your choice in the variables such that the variables represent the given primitive types in the given order:
<code>varA</code>: Number
<code>varB</code>: String
<code>varC</code>: Boolean
<co... | Compilable |
For this Question: Write a program to print Five stars ('*') <b><i>vertically</i></b> and 5 <b><i>horizontally</i></b>
There will be two functions:
<ul>
<li>verticalFive(): Print stars in vertical order</li>
<li>horizontalFive(): Print stars in horizontal order</l>
</ul><b>User Task:</b>
Your task is to complet... | Compilable |
For this Question: Write a program to print Five stars ('*') <b><i>vertically</i></b> and 5 <b><i>horizontally</i></b>
There will be two functions:
<ul>
<li>verticalFive(): Print stars in vertical order</li>
<li>horizontalFive(): Print stars in horizontal order</l>
</ul><b>User Task:</b>
Your task is to complet... | Compilable |
For this Question: Find factorial of a given number N.
<b>Note: </b>
The Factorial of a number is the product of an integer and all the integers below it;
e.g. factorial four ( 4! ) is equal to 24 (4*3*2*1).<b>User Task</b>
Since this is a functional problem, you don't have to worry about the input. You just have ... | Compilable |
For this Question: Find factorial of a given number N.
<b>Note: </b>
The Factorial of a number is the product of an integer and all the integers below it;
e.g. factorial four ( 4! ) is equal to 24 (4*3*2*1).<b>User Task</b>
Since this is a functional problem, you don't have to worry about the input. You just have ... | Compilable |
For this Question: Find factorial of a given number N.
<b>Note: </b>
The Factorial of a number is the product of an integer and all the integers below it;
e.g. factorial four ( 4! ) is equal to 24 (4*3*2*1).<b>User Task</b>
Since this is a functional problem, you don't have to worry about the input. You just have ... | Compilable |
For this Question: You are given an array of N integers A1, A2,. . An. You have to calculate prosum of the array.
Prosum is defined as the sum of all Ai x Aj over all pairs (i, j) such that 1 <= i < j <= N, modulo (10^9 + 7)The first line of the input contains a single integer N
The next line of the input contains N ... | Compilable |
For this Question: Harry is very confused after knowing all about Sirius. To lighten Harry's mood Sirius asks a fun problem to him. Sirius puts K talking skulls equally spaced on the circumference of a circle. Now he enumerates them from 1 to K in clockwise order. Now given skull X and skull Z, he asks Harry to find nu... | Compilable |
For this Question: Harry is very confused after knowing all about Sirius. To lighten Harry's mood Sirius asks a fun problem to him. Sirius puts K talking skulls equally spaced on the circumference of a circle. Now he enumerates them from 1 to K in clockwise order. Now given skull X and skull Z, he asks Harry to find nu... | Compilable |
For this Question: Harry is very confused after knowing all about Sirius. To lighten Harry's mood Sirius asks a fun problem to him. Sirius puts K talking skulls equally spaced on the circumference of a circle. Now he enumerates them from 1 to K in clockwise order. Now given skull X and skull Z, he asks Harry to find nu... | Compilable |
For this Question: Given a matrix of N * M. Find the maximum path sum in matrix. The maximum path sum is sum of path elements from first row to last row where you are allowed to move only down(from (i,j) to (i+1,j)) or diagonally to left(from (i,j) to (i+1,j-1)) or right(from (i,j) to (i+1,j+1)). You can start from any... | Compilable |
For this Question: Given a matrix of N * M. Find the maximum path sum in matrix. The maximum path sum is sum of path elements from first row to last row where you are allowed to move only down(from (i,j) to (i+1,j)) or diagonally to left(from (i,j) to (i+1,j-1)) or right(from (i,j) to (i+1,j+1)). You can start from any... | Compilable |
For this Question: Given the length, breadth, and height of a cuboid. Your task is to calculate its Perimeter.
Note:- Formula for the perimeter of the cuboid is 4(Length + Breadth + height)<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function... | Compilable |
For this Question: Given the length, breadth, and height of a cuboid. Your task is to calculate its Perimeter.
Note:- Formula for the perimeter of the cuboid is 4(Length + Breadth + height)<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function... | Compilable |
For this Question: N people are standing in a queue in which A of them like apple and B of them like oranges. How many people like both apple and oranges.
<b>Note</b>:- It is guaranteed that each and every person likes at least one of the given two.<b>User Task:</b>
Since this will be a functional problem, you don... | Compilable |
For this Question: N people are standing in a queue in which A of them like apple and B of them like oranges. How many people like both apple and oranges.
<b>Note</b>:- It is guaranteed that each and every person likes at least one of the given two.<b>User Task:</b>
Since this will be a functional problem, you don... | Compilable |
For this Question: N people are standing in a queue in which A of them like apple and B of them like oranges. How many people like both apple and oranges.
<b>Note</b>:- It is guaranteed that each and every person likes at least one of the given two.<b>User Task:</b>
Since this will be a functional problem, you don... | Compilable |
For this Question: N people are standing in a queue in which A of them like apple and B of them like oranges. How many people like both apple and oranges.
<b>Note</b>:- It is guaranteed that each and every person likes at least one of the given two.<b>User Task:</b>
Since this will be a functional problem, you don... | Compilable |
For this Question: Newton being a student of science gifted an <b>nXn</b> matrix to his girlfriend on her birthday and challenge her to solve the matrix. The matrix consists of natural numbers up to 500(1 ≤ n ≤ 500). Newton instructed a few things about matrix to his girlfriend. He said there are two types of sym... | Compilable |
For this Question: Newton being a student of science gifted an <b>nXn</b> matrix to his girlfriend on her birthday and challenge her to solve the matrix. The matrix consists of natural numbers up to 500(1 ≤ n ≤ 500). Newton instructed a few things about matrix to his girlfriend. He said there are two types of sym... | Compilable |
For this Question: Let's define P[i] as the ith Prime Number. Therefore, P[1]=2, P[2]=3, P[3]=5, so on.
Given two integers L, R (L<=R), find the value of P[L]+P[L+1]+P[L+2]...+P[R].The first line of the input contains an integer T denoting the number of test cases.
The next T lines contain two integers L and R.
Co... | Compilable |
For this Question: Let's define P[i] as the ith Prime Number. Therefore, P[1]=2, P[2]=3, P[3]=5, so on.
Given two integers L, R (L<=R), find the value of P[L]+P[L+1]+P[L+2]...+P[R].The first line of the input contains an integer T denoting the number of test cases.
The next T lines contain two integers L and R.
Co... | Compilable |
For this Question: Let's define P[i] as the ith Prime Number. Therefore, P[1]=2, P[2]=3, P[3]=5, so on.
Given two integers L, R (L<=R), find the value of P[L]+P[L+1]+P[L+2]...+P[R].The first line of the input contains an integer T denoting the number of test cases.
The next T lines contain two integers L and R.
Co... | Compilable |
For this Question: Given an integer N, find the closest prime number to N. If there are multiple print the smaller one.The input contains a single integer N.
Constraints:
1 <= N <= 1000000000Print the closest prime to N.Sample Input 1
12
Sample Output 1
11
Explanation: Closest prime to 12 is 11 and 13 small... | Compilable |
For this Question: Given an integer N, find the closest prime number to N. If there are multiple print the smaller one.The input contains a single integer N.
Constraints:
1 <= N <= 1000000000Print the closest prime to N.Sample Input 1
12
Sample Output 1
11
Explanation: Closest prime to 12 is 11 and 13 small... | Compilable |
For this Question: Given an integer N, find the closest prime number to N. If there are multiple print the smaller one.The input contains a single integer N.
Constraints:
1 <= N <= 1000000000Print the closest prime to N.Sample Input 1
12
Sample Output 1
11
Explanation: Closest prime to 12 is 11 and 13 small... | Compilable |
For this Question: Subtract two numbers without using arithmetic operators and print the result.Only line contains two integers a and b.
<b>Constraints</b>
1 <= a, b <= 10<sup>9</sup>print the result of (a- b).Input:
3 7
Output:
-4, I have written this Solution Code: import java.io.*;
import java.util.*;
... | Compilable |
For this Question: Given a string s, find the first non-repeating character in the string and return its index. If it does not exist, return -1.First line of the input contains the string s.
<b>Constraints</b>
1<= s. length <= 100000Print the index of the first non- repeating character in a stringInput
s = "newto... | Compilable |
For this Question: Given a string s, find the first non-repeating character in the string and return its index. If it does not exist, return -1.First line of the input contains the string s.
<b>Constraints</b>
1<= s. length <= 100000Print the index of the first non- repeating character in a stringInput
s = "newto... | Compilable |
For this Question: Given a string s, find the first non-repeating character in the string and return its index. If it does not exist, return -1.First line of the input contains the string s.
<b>Constraints</b>
1<= s. length <= 100000Print the index of the first non- repeating character in a stringInput
s = "newto... | Compilable |
For this Question: A graph is given with N nodes and M edges. The first visit to a vertex i will give 2<sup>i-1</sup> -1 score. Initially, we are at node 1. Then calculate the maximum score that we can get if we are only allowed to move to an adjacent vertex at most K times.First line contains 3 integers separated by s... | Compilable |
For this Question: Given a 2*N matrix in which each cell contains some candies in it. You are at the top left corner of the matrix and want to reach the bottom right corner of the matrix i. e from (1, 1) to (2, N). You can only move right or down. You have to find the maximum number of candies you can collect in your j... | Compilable |
For this Question: Given the length, breadth, and height of a cuboid. Your task is to calculate its Perimeter.
Note:- Formula for the perimeter of the cuboid is 4(Length + Breadth + height)<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function... | Compilable |
For this Question: Given the length, breadth, and height of a cuboid. Your task is to calculate its Perimeter.
Note:- Formula for the perimeter of the cuboid is 4(Length + Breadth + height)<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function... | Compilable |
For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them.
You are given a sequential order of N soldiers st... | Compilable |
For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them.
You are given a sequential order of N soldiers st... | Compilable |
For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them.
You are given a sequential order of N soldiers st... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given a number N, find the value of the below Equation for the given number.
Equation: -
N
∑ {(X - 1)<sup>3</sup> + 3(X + 1)<sup>2</sup> + 2}
X = 1<b>User task:</b>
Since this is a functional problem, you don’t have to worry about the input, you just have to complete the function <b>equationSu... | Compilable |
For this Question: Given a number N, find the value of the below Equation for the given number.
Equation: -
N
∑ {(X - 1)<sup>3</sup> + 3(X + 1)<sup>2</sup> + 2}
X = 1<b>User task:</b>
Since this is a functional problem, you don’t have to worry about the input, you just have to complete the function <b>equationSu... | Compilable |
For this Question: Given a number N, find the value of the below Equation for the given number.
Equation: -
N
∑ {(X - 1)<sup>3</sup> + 3(X + 1)<sup>2</sup> + 2}
X = 1<b>User task:</b>
Since this is a functional problem, you don’t have to worry about the input, you just have to complete the function <b>equationSu... | Compilable |
For this Question: Given a number N, find the value of the below Equation for the given number.
Equation: -
N
∑ {(X - 1)<sup>3</sup> + 3(X + 1)<sup>2</sup> + 2}
X = 1<b>User task:</b>
Since this is a functional problem, you don’t have to worry about the input, you just have to complete the function <b>equationSu... | Compilable |
For this Question: Given an array of N strings, find the longest common prefix among all strings present in the array.The fist line of each test contains a single integer N. Next line has space-separated N strings.
Constraints:-
1 <= N <= 10^3
1 <= |S| <= 10^3
Print the longest common prefix as a string in the gi... | Compilable |
For this Question: Given an array of N strings, find the longest common prefix among all strings present in the array.The fist line of each test contains a single integer N. Next line has space-separated N strings.
Constraints:-
1 <= N <= 10^3
1 <= |S| <= 10^3
Print the longest common prefix as a string in the gi... | Compilable |
For this Question: Given an array of N strings, find the longest common prefix among all strings present in the array.The fist line of each test contains a single integer N. Next line has space-separated N strings.
Constraints:-
1 <= N <= 10^3
1 <= |S| <= 10^3
Print the longest common prefix as a string in the gi... | Compilable |
For this Question: Given an array of N strings, find the longest common prefix among all strings present in the array.The fist line of each test contains a single integer N. Next line has space-separated N strings.
Constraints:-
1 <= N <= 10^3
1 <= |S| <= 10^3
Print the longest common prefix as a string in the gi... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: There are N balloons numbered from 1 to N. Every balloon has an another integer value Arr[i] assigned to it where i varies from 1 to N, and i represents the number of balloon.
A balloon at an odd position (i = 1, 3, 5. ) is happy if Arr[i] is odd.
A balloon at an even position (i = 2, 4, 6. ) is ... | Compilable |
For this Question: There are N balloons numbered from 1 to N. Every balloon has an another integer value Arr[i] assigned to it where i varies from 1 to N, and i represents the number of balloon.
A balloon at an odd position (i = 1, 3, 5. ) is happy if Arr[i] is odd.
A balloon at an even position (i = 2, 4, 6. ) is ... | Compilable |
For this Question: There are N balloons numbered from 1 to N. Every balloon has an another integer value Arr[i] assigned to it where i varies from 1 to N, and i represents the number of balloon.
A balloon at an odd position (i = 1, 3, 5. ) is happy if Arr[i] is odd.
A balloon at an even position (i = 2, 4, 6. ) is ... | Compilable |
For this Question: Write a program to print Five stars ('*') <b><i>vertically</i></b> and 5 <b><i>horizontally</i></b>
There will be two functions:
<ul>
<li>verticalFive(): Print stars in vertical order</li>
<li>horizontalFive(): Print stars in horizontal order</l>
</ul><b>User Task:</b>
Your task is to complet... | Compilable |
For this Question: Write a program to print Five stars ('*') <b><i>vertically</i></b> and 5 <b><i>horizontally</i></b>
There will be two functions:
<ul>
<li>verticalFive(): Print stars in vertical order</li>
<li>horizontalFive(): Print stars in horizontal order</l>
</ul><b>User Task:</b>
Your task is to complet... | Compilable |
For this Question: Ketani is fond of super simple problems. This time he has come up with another simple problem. Given two non negative numbers A and B. Find the number of multiples of k in the range [A, B] (all integers between A and B, A and B inclusive).The first and the only line of input contains three integers: ... | Compilable |
For this Question: Ketani is fond of super simple problems. This time he has come up with another simple problem. Given two non negative numbers A and B. Find the number of multiples of k in the range [A, B] (all integers between A and B, A and B inclusive).The first and the only line of input contains three integers: ... | Compilable |
For this Question: Ketani is fond of super simple problems. This time he has come up with another simple problem. Given two non negative numbers A and B. Find the number of multiples of k in the range [A, B] (all integers between A and B, A and B inclusive).The first and the only line of input contains three integers: ... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given four integers a, b, c, and d. Find the value of a<sup>(b<sup>(c<sup>d</sup>)</sup>)</sup> modulo 1000000007.
(Fact: 0<sup>0</sup> = 1)The first and the only line of input contains 4 integers a, b, c, and d.
Constraints
1 <= a, b, c, d <= 12Output a single integer, the answer modulo 10000... | Compilable |
For this Question: Given a number N. The task is to generate and print all binary numbers with decimal values from 1 to N.
Try solving this using a queue.The only line of input contains a single integer N.
1 <= N <= 50000Print all binary numbers with decimal values from 1 to N in a single line.Sample Input:
5
... | Compilable |
For this Question: Given a number N. The task is to generate and print all binary numbers with decimal values from 1 to N.
Try solving this using a queue.The only line of input contains a single integer N.
1 <= N <= 50000Print all binary numbers with decimal values from 1 to N in a single line.Sample Input:
5
... | Compilable |
For this Question: Given a number N. The task is to generate and print all binary numbers with decimal values from 1 to N.
Try solving this using a queue.The only line of input contains a single integer N.
1 <= N <= 50000Print all binary numbers with decimal values from 1 to N in a single line.Sample Input:
5
... | Compilable |
For this Question: Sara is trying a new magic trick on you, The magic trick goes in 6 steps:-
1. Think of a number X(don't tell Sara)
2. Add A(Given by Sara) to it.
3. Double the sum in your mind.
4. Add an even number B(Given by Sara) to it.
5. Half the amount
6. Subtract the initial number which you had taken ... | Compilable |
For this Question: Sara is trying a new magic trick on you, The magic trick goes in 6 steps:-
1. Think of a number X(don't tell Sara)
2. Add A(Given by Sara) to it.
3. Double the sum in your mind.
4. Add an even number B(Given by Sara) to it.
5. Half the amount
6. Subtract the initial number which you had taken ... | Compilable |
For this Question: Sara is trying a new magic trick on you, The magic trick goes in 6 steps:-
1. Think of a number X(don't tell Sara)
2. Add A(Given by Sara) to it.
3. Double the sum in your mind.
4. Add an even number B(Given by Sara) to it.
5. Half the amount
6. Subtract the initial number which you had taken ... | Compilable |
For this Question: A string is called square if it is some string written twice in a row. For example, the strings "aa", "abcabc", "abab" and "baabaa" are square. But the strings "aaa", "abaaab" and "abcdabc" are not square. For a given string s determine if it is square.The input consists of a string S consisting of l... | Compilable |
For this Question: There are 3 points, X, Y, and Z on a road.
It takes A hours to travel from X to Y or from Y to X.
It takes B hours to travel from Y to Z or from Z to Y.
It takes C hours to travel from X to Z or from Z to X.
Newton is given the time required to travel between the points, i. e. A, B and C. He want... | Compilable |
For this Question: The head of the doubly linked list will be given to you, and you must sort it using merge sort.You will be given the head of doubly Linked List and its length.
Constraints:
0<= n <=10000Return the HEAD of the sorted linked list.Sample Input:
5
3 2 1 3 2
Output:
1 2 2 3 3, I have written this... | Compilable |
For this Question: The head of the doubly linked list will be given to you, and you must sort it using merge sort.You will be given the head of doubly Linked List and its length.
Constraints:
0<= n <=10000Return the HEAD of the sorted linked list.Sample Input:
5
3 2 1 3 2
Output:
1 2 2 3 3, I have written this... | Compilable |
For this Question: Given a binary tree of N nodes, with root 1 and Q queries with nodes u and v. For each query find the sum of nodes on the shortest path from u to v, where node v is the ancestor of node u.First line contains the integer N and Q, denoting the number of nodes in the binary tree and the number of querie... | Compilable |
For this Question: Given a binary tree of N nodes, with root 1 and Q queries with nodes u and v. For each query find the sum of nodes on the shortest path from u to v, where node v is the ancestor of node u.First line contains the integer N and Q, denoting the number of nodes in the binary tree and the number of querie... | Compilable |
For this Question: You are given resistance value of N resistors. Find the net resistance of the system when all of these N resistors are connected in parallel.
If there are three resistors A1, A2, A3, when they are connected in parallel, the net resistance will be 1/((1/A1) + (1/A2) + (1/A3))
Since this number c... | Compilable |
For this Question: You are given resistance value of N resistors. Find the net resistance of the system when all of these N resistors are connected in parallel.
If there are three resistors A1, A2, A3, when they are connected in parallel, the net resistance will be 1/((1/A1) + (1/A2) + (1/A3))
Since this number c... | Compilable |
For this Question: You are given resistance value of N resistors. Find the net resistance of the system when all of these N resistors are connected in parallel.
If there are three resistors A1, A2, A3, when they are connected in parallel, the net resistance will be 1/((1/A1) + (1/A2) + (1/A3))
Since this number c... | Compilable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.