Instruction stringlengths 261 35k | Response stringclasses 1
value |
|---|---|
For this Question: You have to write 4 classes as BubbleSort, InsertionSort, MergeSort and SelectionSort, and each of should implement following interface:
<code>
interface ISort{
public int[] sort(int[] arr);
}
</code>
Each class should be defined as:
Implement sort in each class with respective method... | Compilable |
For this Question: You are given a chessboard of size N x N, where the top left square is black. Each square contains a value. Find the sum of the values of all black squares and all white squares.
Remember that in a chessboard black and white squares are alternate.The first line of input will be the N size of the m... | Compilable |
For this Question: You are given a chessboard of size N x N, where the top left square is black. Each square contains a value. Find the sum of the values of all black squares and all white squares.
Remember that in a chessboard black and white squares are alternate.The first line of input will be the N size of the m... | 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: 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: Given an integer N such that no digit of N is 0, find minimum numbers of digits that need to be removed from N such that N becomes divisible by 3. Note: if all the digits of N needs to removed report -1.Input contains a single integer N.
Constraints:
1 <= N <= 10^18
No digit of N is 0.Print the ... | Compilable |
For this Question: Given an integer N such that no digit of N is 0, find minimum numbers of digits that need to be removed from N such that N becomes divisible by 3. Note: if all the digits of N needs to removed report -1.Input contains a single integer N.
Constraints:
1 <= N <= 10^18
No digit of N is 0.Print the ... | Compilable |
For this Question: Given an integer N such that no digit of N is 0, find minimum numbers of digits that need to be removed from N such that N becomes divisible by 3. Note: if all the digits of N needs to removed report -1.Input contains a single integer N.
Constraints:
1 <= N <= 10^18
No digit of N is 0.Print the ... | 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 |
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: 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: You have to write 4 classes as BubbleSort, InsertionSort, MergeSort and SelectionSort, and each of should implement following interface:
<code>
interface ISort{
public int[] sort(int[] arr);
}
</code>
Each class should be defined as:
Implement sort in each class with respective method... | Compilable |
For this Question: We define a weird series as follows:
7, 77, 777, 7777, 77777, 777777,. .
Given a positive integer N find where is first occurrence of a number divisible by N in the given series.
If the series contains no multiple of N, print -1 instead.Input contains a single integer N.
Constraints:
1 <= N <=... | Compilable |
For this Question: We define a weird series as follows:
7, 77, 777, 7777, 77777, 777777,. .
Given a positive integer N find where is first occurrence of a number divisible by N in the given series.
If the series contains no multiple of N, print -1 instead.Input contains a single integer N.
Constraints:
1 <= N <=... | Compilable |
For this Question: We define a weird series as follows:
7, 77, 777, 7777, 77777, 777777,. .
Given a positive integer N find where is first occurrence of a number divisible by N in the given series.
If the series contains no multiple of N, print -1 instead.Input contains a single integer N.
Constraints:
1 <= N <=... | Compilable |
For this Question: Given a linked list consisting of N nodes, your task is to check if the given list is palindrome or not.
A palindrome is a string/number that mirrors itself, for example, 21312 reverse is also 21312.User task:
Since this will be a functional problem, you don't have to take input. You just have to... | Compilable |
For this Question: Given a linked list consisting of N nodes, your task is to check if the given list is palindrome or not.
A palindrome is a string/number that mirrors itself, for example, 21312 reverse is also 21312.User task:
Since this will be a functional problem, you don't have to take input. You just have to... | Compilable |
For this Question: There are N buildings numbered from 1 to N in a straight line, the i<sup>th</sup> building having height h<sub>i</sub>. You start from building 1 and move towards building N. If the height of the next building is greater than the current, you expend twice the difference in the heights of the building... | Compilable |
For this Question: There are N buildings numbered from 1 to N in a straight line, the i<sup>th</sup> building having height h<sub>i</sub>. You start from building 1 and move towards building N. If the height of the next building is greater than the current, you expend twice the difference in the heights of the building... | Compilable |
For this Question: Given an array of positive integers. The task is to find inversion count of array.
Inversion Count : For an array, inversion count indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion c... | Compilable |
For this Question: Given an array of positive integers. The task is to find inversion count of array.
Inversion Count : For an array, inversion count indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion c... | Compilable |
For this Question: Given a number N. Find whether the given number is a perfect cube.
Expected Time Complexity: O(log n)First line contains an integer N
Constraints
1 <= N <= 100000Print "YES" if x is a perfect cube otherwise print "NO".Sample Input:
8
Output:
YES
Sample Input:
7
Output:
NO, I have ... | Compilable |
For this Question: Given a number N. Find whether the given number is a perfect cube.
Expected Time Complexity: O(log n)First line contains an integer N
Constraints
1 <= N <= 100000Print "YES" if x is a perfect cube otherwise print "NO".Sample Input:
8
Output:
YES
Sample Input:
7
Output:
NO, I have ... | Compilable |
For this Question: Given a number N. Find whether the given number is a perfect cube.
Expected Time Complexity: O(log n)First line contains an integer N
Constraints
1 <= N <= 100000Print "YES" if x is a perfect cube otherwise print "NO".Sample Input:
8
Output:
YES
Sample Input:
7
Output:
NO, I have ... | 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: Sara selects two different numbers from the range 1 to 50 and noted their sum as N. However later she Forgets which numbers she selected and now wants to know the total number of possible combinations she can have.<b>User Task:</b>
Since this will be a functional problem, you don't have to take inpu... | Compilable |
For this Question: Sara selects two different numbers from the range 1 to 50 and noted their sum as N. However later she Forgets which numbers she selected and now wants to know the total number of possible combinations she can have.<b>User Task:</b>
Since this will be a functional problem, you don't have to take inpu... | Compilable |
For this Question: Sara selects two different numbers from the range 1 to 50 and noted their sum as N. However later she Forgets which numbers she selected and now wants to know the total number of possible combinations she can have.<b>User Task:</b>
Since this will be a functional problem, you don't have to take inpu... | Compilable |
For this Question: Sara selects two different numbers from the range 1 to 50 and noted their sum as N. However later she Forgets which numbers she selected and now wants to know the total number of possible combinations she can have.<b>User Task:</b>
Since this will be a functional problem, you don't have to take inpu... | Compilable |
For this Question: Implement <code>getObjKeys</code> which only takes one argument which will be a object.
The function should return all they keys present in object as a string where elements are seperated by a ', '. (No nested objects)(Use JS Built in function)Function will take one argument which will be an objectF... | 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: the user would input n first, which is the number of datapoints in the dataset, then he will enter the actual dataset consisting of n numbers, find the mode of those, there might NOT be a unique mode, so print the first element which is a possible mode as entered by user.
find the mean and median of... | Compilable |
For this Question: the user would input n first, which is the number of datapoints in the dataset, then he will enter the actual dataset consisting of n numbers, find the mode of those, there might NOT be a unique mode, so print the first element which is a possible mode as entered by user.
find the mean and median of... | Compilable |
For this Question: Given an array of N integers, your task is to calculate the largest number that can be formed by appending the numbers from the given array.
For eg:- If the numbers are { 10, 3, 31} then the largest number will be 33110First line of input contains a single integer N, next line contains N space separ... | Compilable |
For this Question: Given an array of N integers, your task is to calculate the largest number that can be formed by appending the numbers from the given array.
For eg:- If the numbers are { 10, 3, 31} then the largest number will be 33110First line of input contains a single integer N, next line contains N space separ... | 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 |
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: You are given an array A of N integers. Determine the minimum value of the following expression for all i, j valid : (A<sub>i</sub> and A<sub>j</sub>) xor (A<sub>i</sub> or A<sub>j</sub>), where i ≠ j.First line: A single integer T denoting the number of test cases
For each test case:
<ul style=... | Compilable |
For this Question: You are given an array A of N integers. Determine the minimum value of the following expression for all i, j valid : (A<sub>i</sub> and A<sub>j</sub>) xor (A<sub>i</sub> or A<sub>j</sub>), where i ≠ j.First line: A single integer T denoting the number of test cases
For each test case:
<ul style=... | Compilable |
For this Question: Sara wants to be the best programmer in the world but today she is stuck on an easy problem. Help her to solve it.
<b>Problem description:- </b>
Choose an integer N and subtract the sum of digits of the number N from it i. e. if N is 245 then subtract 2+4+5 from it making it 245 - 11 = 234.
Kee... | Compilable |
For this Question: Sara wants to be the best programmer in the world but today she is stuck on an easy problem. Help her to solve it.
<b>Problem description:- </b>
Choose an integer N and subtract the sum of digits of the number N from it i. e. if N is 245 then subtract 2+4+5 from it making it 245 - 11 = 234.
Kee... | Compilable |
For this Question: Sara wants to be the best programmer in the world but today she is stuck on an easy problem. Help her to solve it.
<b>Problem description:- </b>
Choose an integer N and subtract the sum of digits of the number N from it i. e. if N is 245 then subtract 2+4+5 from it making it 245 - 11 = 234.
Kee... | Compilable |
For this Question: Write a function that creates a binary tree similar to given figure:NonePreorder traversal of the binary treeInput: None
Output:
1 2 5 6 3, I have written this Solution Code: public static void main(String[] args) {
Node root = new Node(1);
root.left = new Node(2);
root.right = new Node... | Compilable |
For this Question: You are given two integers N and M (N > M). You have to find the smallest integer <b>X</b> such that <i>N - M <= X <= N + M</i> and <i>M - X <= X - N</i>First and the only line of the input contains two integers N and M.
Constraints:
1 <= N < M <= 10<sup>9</sup>Find and print the smallest integer... | 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 |
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 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: 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: 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: You are given two sorted arrays A and B of size N and M respectively.
You have to find the value V, which is the summation of (A[j] - A[i]) for all pairs of i and j such that (j - i) is present in array B.The first line contains two space separated integers N and M – size of arrays A and B respect... | Compilable |
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:-
a) First element is replaced by multiplication of first and second.
b) Last element is replaced by multiplication of last and second last.
See example ... | Compilable |
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:-
a) First element is replaced by multiplication of first and second.
b) Last element is replaced by multiplication of last and second last.
See example ... | Compilable |
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:-
a) First element is replaced by multiplication of first and second.
b) Last element is replaced by multiplication of last and second last.
See example ... | Compilable |
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:-
a) First element is replaced by multiplication of first and second.
b) Last element is replaced by multiplication of last and second last.
See example ... | Compilable |
For this Question: Given an integer N, your task is to count the minimum number of operations required to make N a perfect square. In each operation you can either subtract from or add to N by 2. i.e you can wither replace N by N + 2 or by N - 2.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: Given an integer N, your task is to count the minimum number of operations required to make N a perfect square. In each operation you can either subtract from or add to N by 2. i.e you can wither replace N by N + 2 or by N - 2.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: Given an integer N, your task is to count the minimum number of operations required to make N a perfect square. In each operation you can either subtract from or add to N by 2. i.e you can wither replace N by N + 2 or by N - 2.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: Given an integer N, your task is to count the minimum number of operations required to make N a perfect square. In each operation you can either subtract from or add to N by 2. i.e you can wither replace N by N + 2 or by N - 2.<b>User Task:</b>
Since this will be a functional problem, you don't have... | Compilable |
For this Question: Given a sorted array <b>arr[]</b> of size <b>N</b> without duplicates, and given a value <b>x</b>. Find the floor of x in given array. Floor of x is defined as the largest element K in arr[] such that K is smaller than or equal to x.
Try to use binary search to solve this problem.First line of inp... | Compilable |
For this Question: Given a sorted array <b>arr[]</b> of size <b>N</b> without duplicates, and given a value <b>x</b>. Find the floor of x in given array. Floor of x is defined as the largest element K in arr[] such that K is smaller than or equal to x.
Try to use binary search to solve this problem.First line of inp... | Compilable |
For this Question: Given a sorted array <b>arr[]</b> of size <b>N</b> without duplicates, and given a value <b>x</b>. Find the floor of x in given array. Floor of x is defined as the largest element K in arr[] such that K is smaller than or equal to x.
Try to use binary search to solve this problem.First line of inp... | Compilable |
For this Question: The flower shop near his house sells flowers of N types. It is found that the store has Ai flowers of the i-th type. We like odd numbers. Therefore, we have decided that there should be an odd number of flowers of each type in the bouquet, and the total number of flowers in the bouquet should also be... | Compilable |
For this Question: The flower shop near his house sells flowers of N types. It is found that the store has Ai flowers of the i-th type. We like odd numbers. Therefore, we have decided that there should be an odd number of flowers of each type in the bouquet, and the total number of flowers in the bouquet should also be... | Compilable |
For this Question: The flower shop near his house sells flowers of N types. It is found that the store has Ai flowers of the i-th type. We like odd numbers. Therefore, we have decided that there should be an odd number of flowers of each type in the bouquet, and the total number of flowers in the bouquet should also be... | Compilable |
For this Question: Given an array of size 2*N in the form as [x1, x2.. xn, y1, y2,. yn], your task is to shuffle the array in the form given as [x1, y1, x2, y2,. xN, yN]First line of input contains a single integer N. Next line of input contains 2*N space separated integers depicting the values of the array.
Constra... | Compilable |
For this Question: Given an array of size 2*N in the form as [x1, x2.. xn, y1, y2,. yn], your task is to shuffle the array in the form given as [x1, y1, x2, y2,. xN, yN]First line of input contains a single integer N. Next line of input contains 2*N space separated integers depicting the values of the array.
Constra... | Compilable |
For this Question: Given an array of size 2*N in the form as [x1, x2.. xn, y1, y2,. yn], your task is to shuffle the array in the form given as [x1, y1, x2, y2,. xN, yN]First line of input contains a single integer N. Next line of input contains 2*N space separated integers depicting the values of the array.
Constra... | 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: Given a number N, your task is to find if it is a perfect square or not.The first line of input contains the number of test cases T, the next T lines contains a single integer N.
<b>Constraints:</b>
1 < = T < = 1000
1 < = N < = 10<sup>12</sup>For each test case, print "YES" if the number N is a ... | Compilable |
For this Question: Given a number N, your task is to find if it is a perfect square or not.The first line of input contains the number of test cases T, the next T lines contains a single integer N.
<b>Constraints:</b>
1 < = T < = 1000
1 < = N < = 10<sup>12</sup>For each test case, print "YES" if the number N is a ... | Compilable |
For this Question: Given a number N, your task is to find if it is a perfect square or not.The first line of input contains the number of test cases T, the next T lines contains a single integer N.
<b>Constraints:</b>
1 < = T < = 1000
1 < = N < = 10<sup>12</sup>For each test case, print "YES" if the number N is a ... | Compilable |
For this Question: You are given a chessboard of size N x N, where the top left square is black. Each square contains a value. Find the sum of the values of all black squares and all white squares.
Remember that in a chessboard black and white squares are alternate.The first line of input will be the N size of the m... | Compilable |
For this Question: You are given a chessboard of size N x N, where the top left square is black. Each square contains a value. Find the sum of the values of all black squares and all white squares.
Remember that in a chessboard black and white squares are alternate.The first line of input will be the N size of the m... | Compilable |
For this Question: Given two integers N and M, your task is to print the number of primes present between N and M (both included).
<b>Note</b>:- You have already provided a function that will check if the given number is prime or not. To use the given function you need to call <b>check_prime(x)</b> where x is the nu... | Compilable |
For this Question: Given two integers N and M, your task is to print the number of primes present between N and M (both included).
<b>Note</b>:- You have already provided a function that will check if the given number is prime or not. To use the given function you need to call <b>check_prime(x)</b> where x is the nu... | Compilable |
For this Question: Given a linked list consisting of N nodes, your task is to check if the given list is palindrome or not.
A palindrome is a string/number that mirrors itself, for example, 21312 reverse is also 21312.User task:
Since this will be a functional problem, you don't have to take input. You just have to... | Compilable |
For this Question: Given a linked list consisting of N nodes, your task is to check if the given list is palindrome or not.
A palindrome is a string/number that mirrors itself, for example, 21312 reverse is also 21312.User task:
Since this will be a functional problem, you don't have to take input. You just have to... | Compilable |
For this Question: Given an integer n holding some random value, your task is to assign value 10 to the given integer.User task:
Since this is a functional problem you don't have to worry about the input. You just have to complete the function <b>Assignment_Operator()</b>, which takes no parameter.
<b>Constraints:<... | Compilable |
For this Question: You are given an array A of size N. Find the number of pairs of indices (i, j) in the array A such that i < j and A<sub>i</sub> - i = A<sub>j</sub> - j.The first line of the input contains a single integer N.
The second line of the input contains N space seperated integers.
Constraints:
1 <= N <... | Compilable |
For this Question: Given an integer n holding some random value, your task is to assign value 10 to the given integer.User task:
Since this is a functional problem you don't have to worry about the input. You just have to complete the function <b>Assignment_Operator()</b>, which takes no parameter.
<b>Constraints:<... | Compilable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.