Instruction stringlengths 261 35k | Response stringclasses 1
value |
|---|---|
For this Question: Given an integer N, your task is to check whether the given number is prime or notThe input contains a single integer N.
Constraints:-
1 <= N <= 100000000000Print "YES" If the given number is prime else print "NO".Sample Input:-
2
Sample Output:-
YES
Sample Input:-
4
Sample Output:-
... | Compilable |
For this Question: Olivia likes triangles. Hence, John decided to give her three integers and ask whether a triangle with edge length as given three integers is possible.
Help Olivia in answering it.The input consists of a single line containing three space-separated integers A, B, and C.
<b>Constraints </b>
1 <= ... | Compilable |
For this Question: Alexa will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will she turn on the air conditioner?The input consists of a single integer X.
<b>Constraints</b>
−40≤X≤40
X is an i... | Compilable |
For this Question: Given an integer <b>N</b>, you need to typecast this integer to String. If the typecasting is done successfully then we will print "<b>Nice Job</b>" otherwise "<b>Wrong answer</b>".User task:
Since this is a functional problem you don't have to worry about the input. You just have to complete the fu... | Compilable |
For this Question: Given an integer <b>N</b>, you need to typecast this integer to String. If the typecasting is done successfully then we will print "<b>Nice Job</b>" otherwise "<b>Wrong answer</b>".User task:
Since this is a functional problem you don't have to worry about the input. You just have to complete the fu... | Compilable |
For this Question: Gian and Suneo want their heights to be equal so they asked Doraemon's help. Doraemon gave a big light to both of them but the both big lights have different speed of magnifying. Let's assume the big light given to Gian can increase height of a person by v1 m/s and that of Suneo's big light is v2 m/s... | Compilable |
For this Question: Gian and Suneo want their heights to be equal so they asked Doraemon's help. Doraemon gave a big light to both of them but the both big lights have different speed of magnifying. Let's assume the big light given to Gian can increase height of a person by v1 m/s and that of Suneo's big light is v2 m/s... | Compilable |
For this Question: Gian and Suneo want their heights to be equal so they asked Doraemon's help. Doraemon gave a big light to both of them but the both big lights have different speed of magnifying. Let's assume the big light given to Gian can increase height of a person by v1 m/s and that of Suneo's big light is v2 m/s... | Compilable |
For this Question: Sara want to buy a toy and for this purpose she goes to a toy shop, there is a special offer going in the toy shop that is if you buy one toy you can get extra k toys for free now Sara wonders what is the minimum amount of money she need to spend so that she can get all the toys.
You are given som... | Compilable |
For this Question: Sara want to buy a toy and for this purpose she goes to a toy shop, there is a special offer going in the toy shop that is if you buy one toy you can get extra k toys for free now Sara wonders what is the minimum amount of money she need to spend so that she can get all the toys.
You are given som... | Compilable |
For this Question: Sara want to buy a toy and for this purpose she goes to a toy shop, there is a special offer going in the toy shop that is if you buy one toy you can get extra k toys for free now Sara wonders what is the minimum amount of money she need to spend so that she can get all the toys.
You are given som... | Compilable |
For this Question: An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings, like in a dictionary.Input contains 5 strings of length 2 separated by spaces.
String contains only uppercase English letters.Print the sorted array.INPUT :
AS KF ER DD JK
OUTPUT :
AS DD... | Compilable |
For this Question: An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings, like in a dictionary.Input contains 5 strings of length 2 separated by spaces.
String contains only uppercase English letters.Print the sorted array.INPUT :
AS KF ER DD JK
OUTPUT :
AS DD... | Compilable |
For this Question: An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings, like in a dictionary.Input contains 5 strings of length 2 separated by spaces.
String contains only uppercase English letters.Print the sorted array.INPUT :
AS KF ER DD JK
OUTPUT :
AS DD... | Compilable |
For this Question: An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings, like in a dictionary.Input contains 5 strings of length 2 separated by spaces.
String contains only uppercase English letters.Print the sorted array.INPUT :
AS KF ER DD JK
OUTPUT :
AS DD... | 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: 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: Sara has two types of apples that have some sweetness level. She has N apples of the first type which costs her P rupees each and M apples of the second type which costs her Q rupees each. She wants to pick apples in such a way that the total sum of sweetness level is equal to or more than X and the ... | Compilable |
For this Question: Sara has two types of apples that have some sweetness level. She has N apples of the first type which costs her P rupees each and M apples of the second type which costs her Q rupees each. She wants to pick apples in such a way that the total sum of sweetness level is equal to or more than X and the ... | Compilable |
For this Question: Sara has two types of apples that have some sweetness level. She has N apples of the first type which costs her P rupees each and M apples of the second type which costs her Q rupees each. She wants to pick apples in such a way that the total sum of sweetness level is equal to or more than X and the ... | Compilable |
For this Question: You are given N intervals, the i<sup>th</sup> of them being [A<sub>i</sub>, B<sub>i</sub>], where A<sub>i</sub> and B<sub>i</sub> are positive integers. Let the union of all these intervals be S. It is easy to see that S can be uniquely represented as an union of disjoint closed intervals. Your task ... | Compilable |
For this Question: Given an infix expression, your task is to convert it into postfix.
<b>Infix expression</b>: The expression of the form a operator b. When an operator is in- between every pair of operands.
<b>Postfix expression</b>: The expression of the form a b operator. When an operator is followed for every ... | Compilable |
For this Question: Given an infix expression, your task is to convert it into postfix.
<b>Infix expression</b>: The expression of the form a operator b. When an operator is in- between every pair of operands.
<b>Postfix expression</b>: The expression of the form a b operator. When an operator is followed for every ... | Compilable |
For this Question: Given an infix expression, your task is to convert it into postfix.
<b>Infix expression</b>: The expression of the form a operator b. When an operator is in- between every pair of operands.
<b>Postfix expression</b>: The expression of the form a b operator. When an operator is followed for every ... | Compilable |
For this Question: Sheldon and Leonard are gone for lunch but none of them have money so they decided to wash dishes. In total, they washed T dishes from which N dishes are washed by Leonard. Now Leonard wants to know the number of dishes Sheldon washed. Help him to find it.The first line of the input contains N and T
... | Compilable |
For this Question: Sheldon and Leonard are gone for lunch but none of them have money so they decided to wash dishes. In total, they washed T dishes from which N dishes are washed by Leonard. Now Leonard wants to know the number of dishes Sheldon washed. Help him to find it.The first line of the input contains N and T
... | Compilable |
For this Question: Sheldon and Leonard are gone for lunch but none of them have money so they decided to wash dishes. In total, they washed T dishes from which N dishes are washed by Leonard. Now Leonard wants to know the number of dishes Sheldon washed. Help him to find it.The first line of the input contains N and T
... | Compilable |
For this Question: Sheldon and Leonard are gone for lunch but none of them have money so they decided to wash dishes. In total, they washed T dishes from which N dishes are washed by Leonard. Now Leonard wants to know the number of dishes Sheldon washed. Help him to find it.The first line of the input contains N and T
... | Compilable |
For this Question: You are given three distinct positive integers, A, B and C, in the input. Your task is to find their median.
The median of a set of integers is the number at the middle position if they are arranged in ascending order.The input consists of a single line containing three integers A, B and C.
<b... | Compilable |
For this Question: You are given three distinct positive integers, A, B and C, in the input. Your task is to find their median.
The median of a set of integers is the number at the middle position if they are arranged in ascending order.The input consists of a single line containing three integers A, B and C.
<b... | Compilable |
For this Question: You are given three distinct positive integers, A, B and C, in the input. Your task is to find their median.
The median of a set of integers is the number at the middle position if they are arranged in ascending order.The input consists of a single line containing three integers A, B and C.
<b... | Compilable |
For this Question: Given a string of length N. You have to select two non- overlapping (no common index) non- empty substrings of odd lengths from that string such that both those substrings are palindrome. You want the product of lengths of those substring to be maximum.Input contains of a single String of length N.
... | Compilable |
For this Question: Given a string of length N. You have to select two non- overlapping (no common index) non- empty substrings of odd lengths from that string such that both those substrings are palindrome. You want the product of lengths of those substring to be maximum.Input contains of a single String of length N.
... | Compilable |
For this Question: Given a string of length N. You have to select two non- overlapping (no common index) non- empty substrings of odd lengths from that string such that both those substrings are palindrome. You want the product of lengths of those substring to be maximum.Input contains of a single String of length N.
... | Compilable |
For this Question: You are given a 2X2 square matrix. You need to find the determinant of the matrix.The input contains two-line, each line contain two integers separated by spaces.
Each element of the matrix is from 1 to 100.Output a single integer, the determinant of the matrix.Sample Input
4 5
2 3
Sample Out... | Compilable |
For this Question: You are given a 2X2 square matrix. You need to find the determinant of the matrix.The input contains two-line, each line contain two integers separated by spaces.
Each element of the matrix is from 1 to 100.Output a single integer, the determinant of the matrix.Sample Input
4 5
2 3
Sample Out... | Compilable |
For this Question: You are given a 2X2 square matrix. You need to find the determinant of the matrix.The input contains two-line, each line contain two integers separated by spaces.
Each element of the matrix is from 1 to 100.Output a single integer, the determinant of the matrix.Sample Input
4 5
2 3
Sample Out... | Compilable |
For this Question: Given an infix expression, your task is to convert it into postfix.
<b>Infix expression</b>: The expression of the form a operator b. When an operator is in- between every pair of operands.
<b>Postfix expression</b>: The expression of the form a b operator. When an operator is followed for every ... | Compilable |
For this Question: Given an infix expression, your task is to convert it into postfix.
<b>Infix expression</b>: The expression of the form a operator b. When an operator is in- between every pair of operands.
<b>Postfix expression</b>: The expression of the form a b operator. When an operator is followed for every ... | Compilable |
For this Question: Given an infix expression, your task is to convert it into postfix.
<b>Infix expression</b>: The expression of the form a operator b. When an operator is in- between every pair of operands.
<b>Postfix expression</b>: The expression of the form a b operator. When an operator is followed for every ... | Compilable |
For this Question: Akash is hosting a farewell party and wants to serve the most delicious pizzas to his K friends. There are N restaurants in the city, numbered from 1 to N, and each restaurant has a rating between 1 and 100. Akash wants to select K different restaurants such that the minimum rating of any selected re... | Compilable |
For this Question: After sitting idle in home for around 2 months, Jiraya has finally come up with a super interesting problem on arrays (or maybe!).
You are given an array A of N integers. You need to choose an index i from 1 to N (inclusive) and divide this array into 2 parts, then find the maximum sum of contiguou... | Compilable |
For this Question: After sitting idle in home for around 2 months, Jiraya has finally come up with a super interesting problem on arrays (or maybe!).
You are given an array A of N integers. You need to choose an index i from 1 to N (inclusive) and divide this array into 2 parts, then find the maximum sum of contiguou... | Compilable |
For this Question: After sitting idle in home for around 2 months, Jiraya has finally come up with a super interesting problem on arrays (or maybe!).
You are given an array A of N integers. You need to choose an index i from 1 to N (inclusive) and divide this array into 2 parts, then find the maximum sum of contiguou... | Compilable |
For this Question: In this season of love, everyone wants to surprise each other.
You are also super excited and you wish to buy roses of 3 different colors. You always buy roses in order, white, yellow, red.
So if you buy 7 roses, they will be "white, yellow, red, white, yellow, red, white".
You need to find the... | Compilable |
For this Question: In this season of love, everyone wants to surprise each other.
You are also super excited and you wish to buy roses of 3 different colors. You always buy roses in order, white, yellow, red.
So if you buy 7 roses, they will be "white, yellow, red, white, yellow, red, white".
You need to find the... | Compilable |
For this Question: In this season of love, everyone wants to surprise each other.
You are also super excited and you wish to buy roses of 3 different colors. You always buy roses in order, white, yellow, red.
So if you buy 7 roses, they will be "white, yellow, red, white, yellow, red, white".
You need to find the... | Compilable |
For this Question: Given a string S you have to remove all pairs of identical letters, which are consecutive. If after the removal there appear new pairs, remove them as well. Repeat this untill no adjacent letter in the string is same.
Note that deleting of the consecutive identical letters can be done in any order, ... | Compilable |
For this Question: Given a string S you have to remove all pairs of identical letters, which are consecutive. If after the removal there appear new pairs, remove them as well. Repeat this untill no adjacent letter in the string is same.
Note that deleting of the consecutive identical letters can be done in any order, ... | Compilable |
For this Question: Given a string S you have to remove all pairs of identical letters, which are consecutive. If after the removal there appear new pairs, remove them as well. Repeat this untill no adjacent letter in the string is same.
Note that deleting of the consecutive identical letters can be done in any order, ... | Compilable |
For this Question: Given an array of N integers, your task is to calculate the sum of bit difference in all pairs which can be formed.The first line of input contains a single integer N, the second line of input contains N space separated integers depicting values of the array.
Constraints:-
1 <= N <= 100000
0 <= ... | Compilable |
For this Question: Given an array of N integers, your task is to calculate the sum of bit difference in all pairs which can be formed.The first line of input contains a single integer N, the second line of input contains N space separated integers depicting values of the array.
Constraints:-
1 <= N <= 100000
0 <= ... | Compilable |
For this Question: Given an array of N integers, your task is to calculate the sum of bit difference in all pairs which can be formed.The first line of input contains a single integer N, the second line of input contains N space separated integers depicting values of the array.
Constraints:-
1 <= N <= 100000
0 <= ... | Compilable |
For this Question: Given an array A and an integer K. Find the maximum for each and every contiguous subarray of size K.
Problem asked in Amazon, Flipkart.The first line of each test case contains a single integer N denoting the size of array and the size of subarray K. The second line contains N space-separated i... | Compilable |
For this Question: Given an array A and an integer K. Find the maximum for each and every contiguous subarray of size K.
Problem asked in Amazon, Flipkart.The first line of each test case contains a single integer N denoting the size of array and the size of subarray K. The second line contains N space-separated i... | Compilable |
For this Question: Given an array A and an integer K. Find the maximum for each and every contiguous subarray of size K.
Problem asked in Amazon, Flipkart.The first line of each test case contains a single integer N denoting the size of array and the size of subarray K. The second line contains N space-separated i... | Compilable |
For this Question: You are given an array Arr of N integers. You have to process Q queries on the array. Each query contains L and R, for each query you have to report the number of indices i in the array such that L <= Arr[i] <= R.First line of input contains two integers N and Q representing number of elements in the... | Compilable |
For this Question: You are given an array Arr of N integers. You have to process Q queries on the array. Each query contains L and R, for each query you have to report the number of indices i in the array such that L <= Arr[i] <= R.First line of input contains two integers N and Q representing number of elements in the... | Compilable |
For this Question: You are given an array Arr of N integers. You have to process Q queries on the array. Each query contains L and R, for each query you have to report the number of indices i in the array such that L <= Arr[i] <= R.First line of input contains two integers N and Q representing number of elements in the... | Compilable |
For this Question: There is a saying in Sara's village that "A number is called prime if the sum of all the factors of N is less than or equal to (3*N)/2 ". Given the number N, your task is to check if it is a myth or a fact for the number given.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: There is a saying in Sara's village that "A number is called prime if the sum of all the factors of N is less than or equal to (3*N)/2 ". Given the number N, your task is to check if it is a myth or a fact for the number given.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: There is a saying in Sara's village that "A number is called prime if the sum of all the factors of N is less than or equal to (3*N)/2 ". Given the number N, your task is to check if it is a myth or a fact for the number given.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: There is a saying in Sara's village that "A number is called prime if the sum of all the factors of N is less than or equal to (3*N)/2 ". Given the number N, your task is to check if it is a myth or a fact for the number given.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: Find number of ways an integer N can be represented as a sum of unique natural numbers.First line contain an integer T denoting number of test cases. Each test case contains a single integer N.
Constraint:-
1 <= T <= 100
0 <= N <= 120Print a single integer containing number of ways.Sample input
... | Compilable |
For this Question: Find number of ways an integer N can be represented as a sum of unique natural numbers.First line contain an integer T denoting number of test cases. Each test case contains a single integer N.
Constraint:-
1 <= T <= 100
0 <= N <= 120Print a single integer containing number of ways.Sample input
... | Compilable |
For this Question: Find number of ways an integer N can be represented as a sum of unique natural numbers.First line contain an integer T denoting number of test cases. Each test case contains a single integer N.
Constraint:-
1 <= T <= 100
0 <= N <= 120Print a single integer containing number of ways.Sample input
... | Compilable |
For this Question: Find number of ways an integer N can be represented as a sum of unique natural numbers.First line contain an integer T denoting number of test cases. Each test case contains a single integer N.
Constraint:-
1 <= T <= 100
0 <= N <= 120Print a single integer containing number of ways.Sample input
... | Compilable |
For this Question: Given an array <b>A</b> of <b>N</b> elements. Find the <b>majority</b> element in the array. A majority element in an array A of size N is an element that appears <b>more than N/2</b> times in the array.The first line of the input contains T denoting the number of testcases. The first line of the tes... | Compilable |
For this Question: You are given a 2X2 square matrix. You need to find the determinant of the matrix.The input contains two-line, each line contain two integers separated by spaces.
Each element of the matrix is from 1 to 100.Output a single integer, the determinant of the matrix.Sample Input
4 5
2 3
Sample Out... | Compilable |
For this Question: You are given a 2X2 square matrix. You need to find the determinant of the matrix.The input contains two-line, each line contain two integers separated by spaces.
Each element of the matrix is from 1 to 100.Output a single integer, the determinant of the matrix.Sample Input
4 5
2 3
Sample Out... | Compilable |
For this Question: You are given a 2X2 square matrix. You need to find the determinant of the matrix.The input contains two-line, each line contain two integers separated by spaces.
Each element of the matrix is from 1 to 100.Output a single integer, the determinant of the matrix.Sample Input
4 5
2 3
Sample Out... | Compilable |
For this Question: Given an integer N find number of positive integers with N digits with all digits in non-decreasing order. As this can be large find ans modulo 1000000007.
For example 111227 is valid whereas 1112231 is not.Input contains one line of input containing a single integer N.
1 <= N <= 1000000000000P... | Compilable |
For this Question: Given an integer N find number of positive integers with N digits with all digits in non-decreasing order. As this can be large find ans modulo 1000000007.
For example 111227 is valid whereas 1112231 is not.Input contains one line of input containing a single integer N.
1 <= N <= 1000000000000P... | 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: There are N candies, i<sup>th</sup> of them costing p<sub>i</sub>. You have M amount of money with you. Find the maximum number of candies you can buy.The first line of the input contains two integers N and M.
The second line of the input contains N space seperated integers.
Constraints:
1 <= N ... | Compilable |
For this Question: Given a binary array A[] of size N. The task is to arrange an array in increasing order.
(O(N) time complexity solution)Every test case contains two lines, first line contains an integer N (size of array) and second line contains space separated elements of array.
1 <= N <= 20
0 <= A[i] <= 1Prin... | Compilable |
For this Question: Given a binary array A[] of size N. The task is to arrange an array in increasing order.
(O(N) time complexity solution)Every test case contains two lines, first line contains an integer N (size of array) and second line contains space separated elements of array.
1 <= N <= 20
0 <= A[i] <= 1Prin... | Compilable |
For this Question: Given a binary array A[] of size N. The task is to arrange an array in increasing order.
(O(N) time complexity solution)Every test case contains two lines, first line contains an integer N (size of array) and second line contains space separated elements of array.
1 <= N <= 20
0 <= A[i] <= 1Prin... | Compilable |
For this Question: Remove duplicates of an array and return an array of only unique elements.An array containing numbers.Space separated unique elements from the array.Sample Input:-
1 2 3 5 1 5 9 1 2 8
Sample Output:-
1 2 3 5 9 8
<b>Explanation:-</b>
Extra 1, 2, and 5 were removed since they were occurring mu... | Compilable |
For this Question: Remove duplicates of an array and return an array of only unique elements.An array containing numbers.Space separated unique elements from the array.Sample Input:-
1 2 3 5 1 5 9 1 2 8
Sample Output:-
1 2 3 5 9 8
<b>Explanation:-</b>
Extra 1, 2, and 5 were removed since they were occurring mu... | Compilable |
For this Question: Given a double linked list consisting of N nodes, your task is to reverse the linked list and return the head of the modified list.<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>Reverse()</b> that takes head node of ... | Compilable |
For this Question: When Sasha was a little girl, she came to know that the LCM of two numbers can be defined as:
LCM(a, b) = ab ⁄ GCD(a, b). However, she was disappointed to learn that LCM was not defined similarly for more than two numbers. She thus defined a new concept, Sasha's LCM, as:
Sasha's LCM(x<sub>1... | Compilable |
For this Question: Given two sorted linked list of size s1 and s2(sizes may or may not be same), your task is to merge them such that resultant list is also sorted.<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>Merge()</b> that takes t... | Compilable |
For this Question: You are given an unsorted array of length n and must sort it using merge sort while also printing the amount of merges that occur throughout the sorting process.The first line of input will be n, which represents the array's length, followed by the n array items in the second line.
Constraints:
0... | Compilable |
For this Question: You are given an unsorted array of length n and must sort it using merge sort while also printing the amount of merges that occur throughout the sorting process.The first line of input will be n, which represents the array's length, followed by the n array items in the second line.
Constraints:
0... | Compilable |
For this Question: Given the first 2 terms A and B of an Arithmetic Series, tell the Nth term of the series.<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>NthAP()</b> that takes the integer A, B, and N as a parameter.
<b>Constraints... | Compilable |
For this Question: Numbers are awesome, larger numbers are more awesome!
Given an array A of size N, you need to find the maximum sum that can be obtained from the elements of the array (the selected elements need not be contiguous). You may even decide to take no element to get a sum of 0.The first line of the input ... | Compilable |
For this Question: Numbers are awesome, larger numbers are more awesome!
Given an array A of size N, you need to find the maximum sum that can be obtained from the elements of the array (the selected elements need not be contiguous). You may even decide to take no element to get a sum of 0.The first line of the input ... | Compilable |
For this Question: Numbers are awesome, larger numbers are more awesome!
Given an array A of size N, you need to find the maximum sum that can be obtained from the elements of the array (the selected elements need not be contiguous). You may even decide to take no element to get a sum of 0.The first line of the input ... | Compilable |
For this Question: <em>Unix time is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970</em>
Implement the function <code>msSinceEpoch</code>, which returns milliseconds since the Unix ep... | Compilable |
For this Question: For an integer N, your task is to calculate sum of first N natural numbers.<b>User Task:</b>
Since this will be a functional problem, you don't have to worry about input. You just have to complete the function <b>sum()</b> which takes the integer N as a parameter.
Constraints:
1 <= N < = 1000000... | Compilable |
For this Question: Write a program to print a number is positive/negative using if- else.The first line contains the number to be checked.
Constraints:
-100000<=n<=100000Prints "Positive number" if the number is positive, "Zero" if the number is zero and "Negative number" if the number is negative.Sample input:
33... | Compilable |
For this Question: Given a string S. Two position i and j of the string are friends if they have the same character. The distance between two friends at positions i and j is defined as |i- j|. Find the sum of distances of all the pairs of friends in the given strings.First line of input contains a single string S.
C... | Compilable |
For this Question: Given a string S. Two position i and j of the string are friends if they have the same character. The distance between two friends at positions i and j is defined as |i- j|. Find the sum of distances of all the pairs of friends in the given strings.First line of input contains a single string S.
C... | Compilable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.