Instruction
stringlengths
261
35k
Response
stringclasses
1 value
For this Question: Sara is trying a new type of game in which she can jump in either the left direction or in the right direction. Also after each jump the range of her jump increases by 1 unit. i.e if starts from 1 in the next jump she has to jump 2 units then 3 units and so on. Given the number of jumps as N, the ra...
Compilable
For this Question: Sara is trying a new type of game in which she can jump in either the left direction or in the right direction. Also after each jump the range of her jump increases by 1 unit. i.e if starts from 1 in the next jump she has to jump 2 units then 3 units and so on. Given the number of jumps as N, the ra...
Compilable
For this Question: Sara is trying a new type of game in which she can jump in either the left direction or in the right direction. Also after each jump the range of her jump increases by 1 unit. i.e if starts from 1 in the next jump she has to jump 2 units then 3 units and so on. Given the number of jumps as N, the ra...
Compilable
For this Question: You are given a number n. Your task is to print the number of prime numbers before that number.The first line of the number of test cases T. Next T lines contains the value of N. <b>Constraints</b> 1 <= T <= 100 1 <= N <= 1000Print the number of primes numbers before that number.Sample Input 1:...
Compilable
For this Question: You are given a number n. Your task is to print the number of prime numbers before that number.The first line of the number of test cases T. Next T lines contains the value of N. <b>Constraints</b> 1 <= T <= 100 1 <= N <= 1000Print the number of primes numbers before that number.Sample Input 1:...
Compilable
For this Question: Given two positive integers X and Y, check if one integer is obtained by rotating bits of other. Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put back to the other end.The only line of input contains two integers X ...
Compilable
For this Question: Given two positive integers X and Y, check if one integer is obtained by rotating bits of other. Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put back to the other end.The only line of input contains two integers X ...
Compilable
For this Question: Given two positive integers X and Y, check if one integer is obtained by rotating bits of other. Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put back to the other end.The only line of input contains two integers X ...
Compilable
For this Question: Given a number N and a number P, your task is to calculate N<sup>P</sup>. Since the ans can be very long calculate your ans as N<sup>P</sup>%M where M = 10<sup>9</sup>+7Input contains only two integers N and P separated by spaces. Constraints:- 1 < = N, P <= 1000000000Print N<sup>P</sup>%M.Sampl...
Compilable
For this Question: Given a number N and a number P, your task is to calculate N<sup>P</sup>. Since the ans can be very long calculate your ans as N<sup>P</sup>%M where M = 10<sup>9</sup>+7Input contains only two integers N and P separated by spaces. Constraints:- 1 < = N, P <= 1000000000Print N<sup>P</sup>%M.Sampl...
Compilable
For this Question: Given a number N and a number P, your task is to calculate N<sup>P</sup>. Since the ans can be very long calculate your ans as N<sup>P</sup>%M where M = 10<sup>9</sup>+7Input contains only two integers N and P separated by spaces. Constraints:- 1 < = N, P <= 1000000000Print N<sup>P</sup>%M.Sampl...
Compilable
For this Question: You are a substitute teacher of a merged class of students of different sections. A few minutes before the period gets over you circulated a sheet of paper for attendance. You told the students to first write their section(A, B, C, D..., Z) and then their roll number(1, 2, 3....) on the sheet of ...
Compilable
For this Question: Given an array A of size N (N is always even), you need to find exactly (N/2) numbers where each number represents the pair-wise sum of consecutive elements of the array A. In simple terms print (A[1]+A[2]), (A[3]+A[4]), ..., (A[N-1]+A[N]).The first line of the input contains the number of test ca...
Compilable
For this Question: Given an array A of size N (N is always even), you need to find exactly (N/2) numbers where each number represents the pair-wise sum of consecutive elements of the array A. In simple terms print (A[1]+A[2]), (A[3]+A[4]), ..., (A[N-1]+A[N]).The first line of the input contains the number of test ca...
Compilable
For this Question: Given an array A of size N (N is always even), you need to find exactly (N/2) numbers where each number represents the pair-wise sum of consecutive elements of the array A. In simple terms print (A[1]+A[2]), (A[3]+A[4]), ..., (A[N-1]+A[N]).The first line of the input contains the number of test ca...
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: You think that integers divisible by K are nice. Given L and R (L<=R), find the number of nice integers from L to R (both inclusive).First Line of input contains three integers L R K Constraints : 0 <= L <= R <= 1000000000000000000(10^18) 1 <= K <= 1000000000000000000(10^18)Output a single int...
Compilable
For this Question: You think that integers divisible by K are nice. Given L and R (L<=R), find the number of nice integers from L to R (both inclusive).First Line of input contains three integers L R K Constraints : 0 <= L <= R <= 1000000000000000000(10^18) 1 <= K <= 1000000000000000000(10^18)Output a single int...
Compilable
For this Question: You think that integers divisible by K are nice. Given L and R (L<=R), find the number of nice integers from L to R (both inclusive).First Line of input contains three integers L R K Constraints : 0 <= L <= R <= 1000000000000000000(10^18) 1 <= K <= 1000000000000000000(10^18)Output a single int...
Compilable
For this Question: Given two integers x and y, check if x can be converted to y by adding F(n) to x where F(n){n>=1} is defined as:- 1+3+9+27+81+. .3^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 function <b>Ifpossible()</b> that takes the inte...
Compilable
For this Question: Given two integers x and y, check if x can be converted to y by adding F(n) to x where F(n){n>=1} is defined as:- 1+3+9+27+81+. .3^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 function <b>Ifpossible()</b> that takes the inte...
Compilable
For this Question: Given two integers x and y, check if x can be converted to y by adding F(n) to x where F(n){n>=1} is defined as:- 1+3+9+27+81+. .3^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 function <b>Ifpossible()</b> that takes the inte...
Compilable
For this Question: Given two integers x and y, check if x can be converted to y by adding F(n) to x where F(n){n>=1} is defined as:- 1+3+9+27+81+. .3^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 function <b>Ifpossible()</b> that takes the inte...
Compilable
For this Question: Given an array <b>nums</b> of N integers where each element is in between 1 to N. Your task is to print all the integers from 1 to N which are not present in the given array.First line contains n the length of input Second line of input contains the array of integers in range from (1 to n) <b> Co...
Compilable
For this Question: Given an array <b>nums</b> of N integers where each element is in between 1 to N. Your task is to print all the integers from 1 to N which are not present in the given array.First line contains n the length of input Second line of input contains the array of integers in range from (1 to n) <b> Co...
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: 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: Given a linked list, the task is to move all 0’s to the front of the linked list. The order of all another element except 0 should be same after rearrangement. Note: Avoid use of any type of Java Collection frameworks. Note: For custom input/output, enter the list in reverse order, and the outp...
Compilable
For this Question: Given an array arr[] of N integers arranged in a circular fashion. Your task is to find the maximum contiguous subarray sum containing at least 1 element.The first line of input contains a single integer T which denotes the number of test cases. The first line of each test case contains a single inte...
Compilable
For this Question: Given an array arr[] of N integers arranged in a circular fashion. Your task is to find the maximum contiguous subarray sum containing at least 1 element.The first line of input contains a single integer T which denotes the number of test cases. The first line of each test case contains a single inte...
Compilable
For this Question: Given an array arr[] of N integers arranged in a circular fashion. Your task is to find the maximum contiguous subarray sum containing at least 1 element.The first line of input contains a single integer T which denotes the number of test cases. The first line of each test case contains a single inte...
Compilable
For this Question: Given an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.Each test case consists of two lines. The first line of each test case is N and S, where N is the size of the array and S is the sum. The second line of each test case contains N s...
Compilable
For this Question: Given an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.Each test case consists of two lines. The first line of each test case is N and S, where N is the size of the array and S is the sum. The second line of each test case contains N s...
Compilable
For this Question: Given an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.Each test case consists of two lines. The first line of each test case is N and S, where N is the size of the array and S is the sum. The second line of each test case contains N 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 an integer array <strong>arr[]</strong> of size <strong>N</strong> and an element <strong>X</strong>. The task is to find and print the indices of the given element if it is present in array if not then print “<strong>Not found</strong>” without quotes. <strong>Note</strong>: The elements m...
Compilable
For this Question: Given an integer array <strong>arr[]</strong> of size <strong>N</strong> and an element <strong>X</strong>. The task is to find and print the indices of the given element if it is present in array if not then print “<strong>Not found</strong>” without quotes. <strong>Note</strong>: The elements m...
Compilable
For this Question: Given an integer array <strong>arr[]</strong> of size <strong>N</strong> and an element <strong>X</strong>. The task is to find and print the indices of the given element if it is present in array if not then print “<strong>Not found</strong>” without quotes. <strong>Note</strong>: The elements m...
Compilable
For this Question: Given an array arr[] of N positive elements. The task is to find the Maximum AND Value generated by any pair of element from the array. Note: AND is bitwise '&' operator.The first line of the input contains a single integer T, denoting the number of test cases. Then T test cases follow. Each test-...
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: Joffrey has issued orders for Stark's execution. Now, you are trying to predict if Stark will survive or not. You are confident that Stark's survival depends on the N<sup>th</sup> fibonacci number's parity. If it is odd you will predict that Stark lives but if it is even you will predict that Stark d...
Compilable
For this Question: Joffrey has issued orders for Stark's execution. Now, you are trying to predict if Stark will survive or not. You are confident that Stark's survival depends on the N<sup>th</sup> fibonacci number's parity. If it is odd you will predict that Stark lives but if it is even you will predict that Stark d...
Compilable
For this Question: Joffrey has issued orders for Stark's execution. Now, you are trying to predict if Stark will survive or not. You are confident that Stark's survival depends on the N<sup>th</sup> fibonacci number's parity. If it is odd you will predict that Stark lives but if it is even you will predict that Stark d...
Compilable
For this Question: N numbers are arranged in Circle. Find the Sum of all K contiguous Sub-arrays.The first line of the input contains an integer N, the length of the array, and K. The next line contains N integers which are elements of the array. <b>User task:</b> Since this is a functional problem you don't have t...
Compilable
For this Question: N numbers are arranged in Circle. Find the Sum of all K contiguous Sub-arrays.The first line of the input contains an integer N, the length of the array, and K. The next line contains N integers which are elements of the array. <b>User task:</b> Since this is a functional problem you don't have t...
Compilable
For this Question: N numbers are arranged in Circle. Find the Sum of all K contiguous Sub-arrays.The first line of the input contains an integer N, the length of the array, and K. The next line contains N integers which are elements of the array. <b>User task:</b> Since this is a functional problem you don't have t...
Compilable
For this Question: N numbers are arranged in Circle. Find the Sum of all K contiguous Sub-arrays.The first line of the input contains an integer N, the length of the array, and K. The next line contains N integers which are elements of the array. <b>User task:</b> Since this is a functional problem you don't have t...
Compilable
For this Question: N numbers are arranged in Circle. Find the Sum of all K contiguous Sub-arrays.The first line of the input contains an integer N, the length of the array, and K. The next line contains N integers which are elements of the array. <b>User task:</b> Since this is a functional problem you don't have t...
Compilable
For this Question: You are given array A of size n. You need to find the maximum-sum sub-array with the condition that you are allowed to skip at most one element.The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case co...
Compilable
For this Question: You are given array A of size n. You need to find the maximum-sum sub-array with the condition that you are allowed to skip at most one element.The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case co...
Compilable
For this Question: Write a program to check whether character is an alphabet or not using conditional operator.The first line of the input contains a character ch. <b>Constraints</b> 'a', 'A' <= ch <= 'z', 'Z'Print "YES" if it's alphabet otherwise "NO".Sample Input : a Sample Output YES, I have written this So...
Compilable
For this Question: Write a program to check whether character is an alphabet or not using conditional operator.The first line of the input contains a character ch. <b>Constraints</b> 'a', 'A' <= ch <= 'z', 'Z'Print "YES" if it's alphabet otherwise "NO".Sample Input : a Sample Output YES, I have written this So...
Compilable
For this Question: Write a program to check whether character is an alphabet or not using conditional operator.The first line of the input contains a character ch. <b>Constraints</b> 'a', 'A' <= ch <= 'z', 'Z'Print "YES" if it's alphabet otherwise "NO".Sample Input : a Sample Output YES, I have written this So...
Compilable
For this Question: Given a circular linked list consisting of N nodes and an integer K, your task is to add the integer K at the end of the list. <b>Note: Sample Input and Output just show how a linked list will look depending on the questions. Do not copy-paste as it is in custom input</b><b>User Task:</b> Sinc...
Compilable
For this Question: You are given a tree rooted at 1 (root is at level 1). The entire tree can be created in the following fashion:- <li> Nodes at odd level have 2 children. So node 1 has two children, nodes 2 and 3. <li> Nodes at even level have 4 children. So node 2 has 4 children, nodes 4, 5, 6, and 7. Similarly no...
Compilable
For this Question: You are given a tree rooted at 1 (root is at level 1). The entire tree can be created in the following fashion:- <li> Nodes at odd level have 2 children. So node 1 has two children, nodes 2 and 3. <li> Nodes at even level have 4 children. So node 2 has 4 children, nodes 4, 5, 6, and 7. Similarly no...
Compilable
For this Question: You are given a tree rooted at 1 (root is at level 1). The entire tree can be created in the following fashion:- <li> Nodes at odd level have 2 children. So node 1 has two children, nodes 2 and 3. <li> Nodes at even level have 4 children. So node 2 has 4 children, nodes 4, 5, 6, and 7. Similarly no...
Compilable
For this Question: Given a number N, find the sum of all the digits of the number Note: Use a recursive method to solve this problem.<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>Sum()</b> that takes the integer N as a parameter. ...
Compilable
For this Question: Given a number N, find the sum of all the digits of the number Note: Use a recursive method to solve this problem.<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>Sum()</b> that takes the integer N as a parameter. ...
Compilable
For this Question: Given a directed graph, detect the presence of a cycle in the graph.The first line of input contains two integers N and M which denotes the no of vertices and no of edges in the graph respectively. Next M lines contain space-separated integers u and v denoting that there is a directed edge from u t...
Compilable
For this Question: Given a directed graph, detect the presence of a cycle in the graph.The first line of input contains two integers N and M which denotes the no of vertices and no of edges in the graph respectively. Next M lines contain space-separated integers u and v denoting that there is a directed edge from u t...
Compilable
For this Question: Given a directed graph, detect the presence of a cycle in the graph.The first line of input contains two integers N and M which denotes the no of vertices and no of edges in the graph respectively. Next M lines contain space-separated integers u and v denoting that there is a directed edge from u t...
Compilable
For this Question: Given a queue of integers and N queries. Your the task is to perform these operations:- enqueue:-this operation will add an element to your current queue. dequeue:-this operation will delete the element from the starting of the queue displayfront:-this operation will print the element presented at...
Compilable
For this Question: Given a number N, you need to check whether the given number is <b>Palindrome</b> or not. A number is said to be Palindrome when it reads the same from backward as forward.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...
Compilable
For this Question: Given a number N, you need to check whether the given number is <b>Palindrome</b> or not. A number is said to be Palindrome when it reads the same from backward as forward.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...
Compilable
For this Question: You are given n integers a<sub>1</sub>, a<sub>2</sub>, …, a<sub>n</sub>. Find the maximum value of <b>max(a<sub>l</sub>, a<sub>l+1</sub>, …, a<sub>r</sub>) * min(a<sub>l</sub>, a<sub>l+1</sub>, …, a<sub>r</sub>)</b> over all pairs (l, r) of integers for which 1 &le; l < r &le; n.The first line of inp...
Compilable
For this Question: Quadratic probing is a collision handling technique in hashing. Quadratic probing says that whenever a collision occurs, search for i^2 position. In this question, we'll learn how to fill up the hash table using Quadratic probing technique. You are given hash table size which you'll use to insert ...
Compilable
For this Question: Quadratic probing is a collision handling technique in hashing. Quadratic probing says that whenever a collision occurs, search for i^2 position. In this question, we'll learn how to fill up the hash table using Quadratic probing technique. You are given hash table size which you'll use to insert ...
Compilable
For this Question: Quadratic probing is a collision handling technique in hashing. Quadratic probing says that whenever a collision occurs, search for i^2 position. In this question, we'll learn how to fill up the hash table using Quadratic probing technique. You are given hash table size which you'll use to insert ...
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: Write a program to check whether a number is even or odd using switch case.First Line of the input contains the number n. <b>Constraints</b> 1 <= n <= 1e9If the number is even print "Even" otherwise "Odd"Sample Input : 23 Sample Output : Odd Sample Input : 24 Sample Output : Even,...
Compilable
For this Question: Write a program to check whether a number is even or odd using switch case.First Line of the input contains the number n. <b>Constraints</b> 1 <= n <= 1e9If the number is even print "Even" otherwise "Odd"Sample Input : 23 Sample Output : Odd Sample Input : 24 Sample Output : Even,...
Compilable
For this Question: Write a program to check whether a number is even or odd using switch case.First Line of the input contains the number n. <b>Constraints</b> 1 <= n <= 1e9If the number is even print "Even" otherwise "Odd"Sample Input : 23 Sample Output : Odd Sample Input : 24 Sample Output : Even,...
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: A number (n) is represented in Linked List such that each digit corresponds to a node in linked list. Add 1 to it. <b>Note:-</b> Linked list representation of a number is from left to right i.e if the number is 123 than in linked list it is represented as 3->2->1<b>User Task:</b> Since this will ...
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: Our Tono has got N cute strings. Cute strings are very loving, and they possess a beautiful property. Whenever two cute strings are placed next to each other, they get concatenated in the following manner: "tono"+"nolo"="tonolo" (suffix-prefix match occurs once). See sample for better understanding....
Compilable
For this Question: When Alexa writes an integer, he uses a comma for every third digit from the right. How many commas will be used in total when she writes each integer from 1 to N (inclusive) once?The input consists of a single integer N. <b>Constraints</b> 1 &le; N &le; 10<sup>15</sup> N is an integer.Print the...
Compilable
For this Question: You will be given an array of N numbers. Your task is to first reverse the array (the first number becomes last, 2nd number becomes 2nd from the last, and so on) and then print the sum of the numbers at even indices and print the product of the numbers at odd indices. <b>Note :</b> 1 based indexin...
Compilable
For this Question: You will be given an array of N numbers. Your task is to first reverse the array (the first number becomes last, 2nd number becomes 2nd from the last, and so on) and then print the sum of the numbers at even indices and print the product of the numbers at odd indices. <b>Note :</b> 1 based indexin...
Compilable
For this Question: You will be given an array of N numbers. Your task is to first reverse the array (the first number becomes last, 2nd number becomes 2nd from the last, and so on) and then print the sum of the numbers at even indices and print the product of the numbers at odd indices. <b>Note :</b> 1 based indexin...
Compilable
For this Question: Implement the power(a, n) function which return the value a<sup>n</sup> in log(n) time complexity. The value can be very large so return the answer with modulo M=1e9+7.You don't have to input anything, just implement the function. Constraints : -10^9 <= a <= 10^9, a!=0 0 <= n <= 10^9You don't ...
Compilable
For this Question: The question is super small and super simple. You are given an integer n. Initially you have an empty string. You need to construct the string of length n with the following rules: 1. Insert the first character in the beginning of string, the second in the end, the third in the beginning, fourth in...
Compilable
For this Question: The question is super small and super simple. You are given an integer n. Initially you have an empty string. You need to construct the string of length n with the following rules: 1. Insert the first character in the beginning of string, the second in the end, the third in the beginning, fourth in...
Compilable
For this Question: You must be familiar with various types of operators. One of the most commonly used operators in any language are increment and decrement operators. Given two numbers X and Y. Your task is to print the value of X decremented by 1 and value of Y after incremented by 1.The first line of the input conta...
Compilable
For this Question: You must be familiar with various types of operators. One of the most commonly used operators in any language are increment and decrement operators. Given two numbers X and Y. Your task is to print the value of X decremented by 1 and value of Y after incremented by 1.The first line of the input conta...
Compilable
For this Question: Given an array of integers A and a number K, find maximum sum of a subarray of size K.The first line of input contains two integers N and K, denoting the number of elements in the array and the subarray size respectively. The next line contains N integers denoting the elements of the array respectiv...
Compilable
For this Question: Given an array of integers A and a number K, find maximum sum of a subarray of size K.The first line of input contains two integers N and K, denoting the number of elements in the array and the subarray size respectively. The next line contains N integers denoting the elements of the array respectiv...
Compilable
For this Question: Given an array of integers A and a number K, find maximum sum of a subarray of size K.The first line of input contains two integers N and K, denoting the number of elements in the array and the subarray size respectively. The next line contains N integers denoting the elements of the array respectiv...
Compilable
For this Question: Ready for a super simple challenge! You are given two integers A and B. You will create a line of boys and girls in the following manner: First A girls, then B boys, then A girls, then B boys, and so on. You will also be given an integer N. Find the number of girls in the first N people of the row...
Compilable
For this Question: Ready for a super simple challenge! You are given two integers A and B. You will create a line of boys and girls in the following manner: First A girls, then B boys, then A girls, then B boys, and so on. You will also be given an integer N. Find the number of girls in the first N people of the row...
Compilable
For this Question: Ready for a super simple challenge! You are given two integers A and B. You will create a line of boys and girls in the following manner: First A girls, then B boys, then A girls, then B boys, and so on. You will also be given an integer N. Find the number of girls in the first N people of the row...
Compilable
For this Question: Given an array A[], of size N containing positive integers. You need to print the elements of an array in increasing order.The first line of the input denotes the number of test cases 'T'. The first line of the test case is the size of the array and the second line consists of array elements. For ...
Compilable