Instruction
stringlengths
261
35k
Response
stringclasses
1 value
For this Question: Given an array Arr of N elements. Find the minimum number of elements that you need to delete from this array such that all the elements in the array become distinct.First line of input contains a single integer N. Second line of input contains N space separated integers, denoting the array Arr. ...
Compilable
For this Question: Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order.The first line of the input contains n ( length of num ) The second line contains the array num. <b>Constraints</b> ...
Compilable
For this Question: Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order.The first line of the input contains n ( length of num ) The second line contains the array num. <b>Constraints</b> ...
Compilable
For this Question: Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order.The first line of the input contains n ( length of num ) The second line contains the array num. <b>Constraints</b> ...
Compilable
For this Question: There are n people in a circle, numbered from 1 to n, each of whom always tells the truth or always lies. Each person i makes a claim of the form: “the number of truth-tellers in this circle is between a<sub>i</sub> and b<sub>i</sub>, inclusive.” Compute the maximum number of people who could be te...
Compilable
For this Question: There are n people in a circle, numbered from 1 to n, each of whom always tells the truth or always lies. Each person i makes a claim of the form: “the number of truth-tellers in this circle is between a<sub>i</sub> and b<sub>i</sub>, inclusive.” Compute the maximum number of people who could be te...
Compilable
For this Question: There are n people in a circle, numbered from 1 to n, each of whom always tells the truth or always lies. Each person i makes a claim of the form: “the number of truth-tellers in this circle is between a<sub>i</sub> and b<sub>i</sub>, inclusive.” Compute the maximum number of people who could be te...
Compilable
For this Question: Given an ArrayList of N lowercase characters. The task is to insert given elements in the list and count frequency of elements present in the list. You can use some inbuilt functions as:- add() to append element in the list contains() to check an element is present or not in the list collecti...
Compilable
For this Question: Given an array of N integers and an integer K, your task is to calculate the count of pairs whose sum is divisible by K.The first line of input contains two integers N and K, the next line contains N space-separated integers depicting values of an array. Constraints:- 1 < = N < = 100000 1 < = Ar...
Compilable
For this Question: Given an array of N integers and an integer K, your task is to calculate the count of pairs whose sum is divisible by K.The first line of input contains two integers N and K, the next line contains N space-separated integers depicting values of an array. Constraints:- 1 < = N < = 100000 1 < = Ar...
Compilable
For this Question: Given an array of N integers and an integer K, your task is to calculate the count of pairs whose sum is divisible by K.The first line of input contains two integers N and K, the next line contains N space-separated integers depicting values of an array. Constraints:- 1 < = N < = 100000 1 < = Ar...
Compilable
For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will ...
Compilable
For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will ...
Compilable
For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will ...
Compilable
For this Question: There is a rule in ludo that a token can only be unlocked when either a 1 or 6 shown in the die. Given the die number N, Your task is to check whether the token can be unlocked or not.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete t...
Compilable
For this Question: There is a rule in ludo that a token can only be unlocked when either a 1 or 6 shown in the die. Given the die number N, Your task is to check whether the token can be unlocked or not.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete t...
Compilable
For this Question: There is a rule in ludo that a token can only be unlocked when either a 1 or 6 shown in the die. Given the die number N, Your task is to check whether the token can be unlocked or not.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete t...
Compilable
For this Question: There is a rule in ludo that a token can only be unlocked when either a 1 or 6 shown in the die. Given the die number N, Your task is to check whether the token can be unlocked or not.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete t...
Compilable
For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them. You are given a sequential order of N soldiers st...
Compilable
For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them. You are given a sequential order of N soldiers st...
Compilable
For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them. You are given a sequential order of N soldiers st...
Compilable
For this Question: Given an Integer n, convert that integer to linked list such that every node contains single digit as character and return the head node.<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>makeList()</b> that takes Intege...
Compilable
For this Question: Given two positive integers N and M. The task is to check whether N is a <b>Special-M-visor</b> or not. <b>Special-M-visor</b>: A number is called Special-m-visor if it has exactly M even divisors for a given N.<b>User Task:</b> Since this is a functional problem, you don’t have to worry about the ...
Compilable
For this Question: Given two positive integers N and M. The task is to check whether N is a <b>Special-M-visor</b> or not. <b>Special-M-visor</b>: A number is called Special-m-visor if it has exactly M even divisors for a given N.<b>User Task:</b> Since this is a functional problem, you don’t have to worry about the ...
Compilable
For this Question: Given two positive integers N and M. The task is to check whether N is a <b>Special-M-visor</b> or not. <b>Special-M-visor</b>: A number is called Special-m-visor if it has exactly M even divisors for a given N.<b>User Task:</b> Since this is a functional problem, you don’t have to worry about the ...
Compilable
For this Question: Given two positive integers N and M. The task is to check whether N is a <b>Special-M-visor</b> or not. <b>Special-M-visor</b>: A number is called Special-m-visor if it has exactly M even divisors for a given N.<b>User Task:</b> Since this is a functional problem, you don’t have to worry about the ...
Compilable
For this Question: Given an array Arr of N elements. Find the minimum number of elements that you need to delete from this array such that all the elements in the array become distinct.First line of input contains a single integer N. Second line of input contains N space separated integers, denoting the array Arr. ...
Compilable
For this Question: Given an array Arr of N elements. Find the minimum number of elements that you need to delete from this array such that all the elements in the array become distinct.First line of input contains a single integer N. Second line of input contains N space separated integers, denoting the array Arr. ...
Compilable
For this Question: Given an array Arr of N elements. Find the minimum number of elements that you need to delete from this array such that all the elements in the array become distinct.First line of input contains a single integer N. Second line of input contains N space separated integers, denoting the array Arr. ...
Compilable
For this Question: Print a right angled triangle of stars of given height N as shown in example.The input contains a single integer N. <b>Constraints:-</b> 1 &le; N &le; 10Print the Right angled triangle of height N.Sample Input:- 3 Sample Output:- * ** *** Sample Input:- 4 Sample Output:- * ** ***...
Compilable
For this Question: Print a right angled triangle of stars of given height N as shown in example.The input contains a single integer N. <b>Constraints:-</b> 1 &le; N &le; 10Print the Right angled triangle of height N.Sample Input:- 3 Sample Output:- * ** *** Sample Input:- 4 Sample Output:- * ** ***...
Compilable
For this Question: Print a right angled triangle of stars of given height N as shown in example.The input contains a single integer N. <b>Constraints:-</b> 1 &le; N &le; 10Print the Right angled triangle of height N.Sample Input:- 3 Sample Output:- * ** *** Sample Input:- 4 Sample Output:- * ** ***...
Compilable
For this Question: Modify the <code>takeMultipleNumbersAndAdd </code> such that it can take any number of arguments and return its sum. This is JS only question.Function should be able to take any number of argsSum of the numberstakeMultipleNumbersAndAdd(1, 2, 2) should return 5 because 1 + 2 + 2 takeMultipleNu...
Compilable
For this Question: Given N and K, find the lexicographically smallest string of length N using only the first K lowercase letters of the alphabet such that each letter is used at least once and no two adjacent characters are equal. If such a string doesn't exist, print -1.The first line of input contains a single i...
Compilable
For this Question: Given N and K, find the lexicographically smallest string of length N using only the first K lowercase letters of the alphabet such that each letter is used at least once and no two adjacent characters are equal. If such a string doesn't exist, print -1.The first line of input contains a single i...
Compilable
For this Question: Given N and K, find the lexicographically smallest string of length N using only the first K lowercase letters of the alphabet such that each letter is used at least once and no two adjacent characters are equal. If such a string doesn't exist, print -1.The first line of input contains a single i...
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: Bob has a list of N numbers. He defines the strength of a number as the sum of all it's digits. If two numbers have the same sum of digits then the greater number will have more strength. For example : 62 and 143 has the same digit sum = 8, but 143 &gt; 62 so the strength of 143 is higher than 62. ...
Compilable
For this Question: Given three numbers tell whether they form a pythagorus triplet or not. Given A , B and C. Three integers form pythagorus triplet if sum of square of two is equal to square of third.The first line of the input contains three space separated integers A, B and C. Constraints 1 <= A,B,C <= 100Th...
Compilable
For this Question: Given three numbers tell whether they form a pythagorus triplet or not. Given A , B and C. Three integers form pythagorus triplet if sum of square of two is equal to square of third.The first line of the input contains three space separated integers A, B and C. Constraints 1 <= A,B,C <= 100Th...
Compilable
For this Question: Given three numbers tell whether they form a pythagorus triplet or not. Given A , B and C. Three integers form pythagorus triplet if sum of square of two is equal to square of third.The first line of the input contains three space separated integers A, B and C. Constraints 1 <= A,B,C <= 100Th...
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: Find the least subarray size <b>K</b> required from two arrays <b>A</b> and <b>B</b> (their positions don't matter), so that the product of the sum of those two subarrays is at least <b>S</b>. If no answer exists, print -1.The first line contains the integer T(the number of test cases). Each test ca...
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: Given an array A[] of size N. The array contains positive and negative elements both. You need to count number of subsequences that has product of its elements as positive. The single positive element of the array will also contribute in the count. <b>Note:</b> Since the answer can be huge you nee...
Compilable
For this Question: Given an array A[] of size N. The array contains positive and negative elements both. You need to count number of subsequences that has product of its elements as positive. The single positive element of the array will also contribute in the count. <b>Note:</b> Since the answer can be huge you nee...
Compilable
For this Question: Andy loves Xor. Dwight gives Andy an integer N and asks him to tell whether XOR of all the integers from 1 to N is even or odd. As Andy is busy flirting with Erin, help him solve this problem.Input contains a single integer N. Constraints: 1 <= N <= 10^9Print "even" if XOR of all the integers fro...
Compilable
For this Question: Andy loves Xor. Dwight gives Andy an integer N and asks him to tell whether XOR of all the integers from 1 to N is even or odd. As Andy is busy flirting with Erin, help him solve this problem.Input contains a single integer N. Constraints: 1 <= N <= 10^9Print "even" if XOR of all the integers fro...
Compilable
For this Question: Andy loves Xor. Dwight gives Andy an integer N and asks him to tell whether XOR of all the integers from 1 to N is even or odd. As Andy is busy flirting with Erin, help him solve this problem.Input contains a single integer N. Constraints: 1 <= N <= 10^9Print "even" if XOR of all the integers fro...
Compilable
For this Question: Given an array of N elements. In the array, each element is present twice except for 1 element whose frequency in the array is 1. Hence the length of the array will always be odd. Find the unique number.An integer, N, representing the size of the array. In the next line, N space-separated integers f...
Compilable
For this Question: Given an array of N elements. In the array, each element is present twice except for 1 element whose frequency in the array is 1. Hence the length of the array will always be odd. Find the unique number.An integer, N, representing the size of the array. In the next line, N space-separated integers f...
Compilable
For this Question: Given an array of N elements. In the array, each element is present twice except for 1 element whose frequency in the array is 1. Hence the length of the array will always be odd. Find the unique number.An integer, N, representing the size of the array. In the next line, N space-separated integers f...
Compilable
For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will ...
Compilable
For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will ...
Compilable
For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will ...
Compilable
For this Question: You are given two integer N and M. You have to construct an array A having N non- negative integers such that the sum of its elements is M. As there are many such arrays possible, find the maximum <a href = "https://en.wikipedia.org/wiki/Median">median</a> of all such possible arrays.The first line o...
Compilable
For this Question: Sky (the blue ranger) wants to replace Jack (the red ranger) from his position. For this, he needs to conquer the entire Base. The Base can be represented as an M*N grid, and Sky needs to conquer it cell by cell. Sky starts conquering the Base from the cell (1, 1). In each move, he conquers the cell...
Compilable
For this Question: Sky (the blue ranger) wants to replace Jack (the red ranger) from his position. For this, he needs to conquer the entire Base. The Base can be represented as an M*N grid, and Sky needs to conquer it cell by cell. Sky starts conquering the Base from the cell (1, 1). In each move, he conquers the cell...
Compilable
For this Question: Sky (the blue ranger) wants to replace Jack (the red ranger) from his position. For this, he needs to conquer the entire Base. The Base can be represented as an M*N grid, and Sky needs to conquer it cell by cell. Sky starts conquering the Base from the cell (1, 1). In each move, he conquers the cell...
Compilable
For this Question: Given two strings A and B, check if the string A is a sub-string of string B or not.First line of input contains a string A, the second line of the input contains the string B. Constraints:- 1 < = |A| < = |B| < = 1000 Note:- String will only contain lowercase english letters.Print "Yes" if the...
Compilable
For this Question: Given two strings A and B, check if the string A is a sub-string of string B or not.First line of input contains a string A, the second line of the input contains the string B. Constraints:- 1 < = |A| < = |B| < = 1000 Note:- String will only contain lowercase english letters.Print "Yes" if the...
Compilable
For this Question: Given two strings A and B, check if the string A is a sub-string of string B or not.First line of input contains a string A, the second line of the input contains the string B. Constraints:- 1 < = |A| < = |B| < = 1000 Note:- String will only contain lowercase english letters.Print "Yes" if the...
Compilable
For this Question: Given an array, A of N integers. Find the product of maximum values for every subarray of size K. Print the answer modulo 10<sup>9</sup>+7. A subarray is any contiguous sequence of elements in an array.The first line contains two integers N and K, denoting the size of the array and the size of the s...
Compilable
For this Question: Given an array, A of N integers. Find the product of maximum values for every subarray of size K. Print the answer modulo 10<sup>9</sup>+7. A subarray is any contiguous sequence of elements in an array.The first line contains two integers N and K, denoting the size of the array and the size of the s...
Compilable
For this Question: Given an array, A of N integers. Find the product of maximum values for every subarray of size K. Print the answer modulo 10<sup>9</sup>+7. A subarray is any contiguous sequence of elements in an array.The first line contains two integers N and K, denoting the size of the array and the size of the s...
Compilable
For this Question: We are given a string. Your task is to compress the consecutive letters of the string For example, given string is "AAACCCBBD", thus here A's occurrence 3 times C's occurrence 3 times B's occurrence 2 times D's occurrence 1 time So after compressing string becomes "A3C3B2D1".The first line o...
Compilable
For this Question: We are given a string. Your task is to compress the consecutive letters of the string For example, given string is "AAACCCBBD", thus here A's occurrence 3 times C's occurrence 3 times B's occurrence 2 times D's occurrence 1 time So after compressing string becomes "A3C3B2D1".The first line o...
Compilable
For this Question: We are given a string. Your task is to compress the consecutive letters of the string For example, given string is "AAACCCBBD", thus here A's occurrence 3 times C's occurrence 3 times B's occurrence 2 times D's occurrence 1 time So after compressing string becomes "A3C3B2D1".The first line o...
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: You are given 2 numbers a, b. You can perform at most b steps In one step : 1- increase a by 3 2- decrease a by 3 3- multiply a by 2 Find number of distinct numbers we can make after performing at most b operations on a.The first line contains the number of tests T. For each test case:...
Compilable
For this Question: You are given 2 numbers a, b. You can perform at most b steps In one step : 1- increase a by 3 2- decrease a by 3 3- multiply a by 2 Find number of distinct numbers we can make after performing at most b operations on a.The first line contains the number of tests T. For each test case:...
Compilable
For this Question: You are given 2 numbers a, b. You can perform at most b steps In one step : 1- increase a by 3 2- decrease a by 3 3- multiply a by 2 Find number of distinct numbers we can make after performing at most b operations on a.The first line contains the number of tests T. For each test case:...
Compilable
For this Question: You are given two arrays - value and frequency both containing N elements. There is also a third array C which is currently empty. Then you perform N insertion operation in the array. For ith operation you insert value[i] to the end of the array frequency[i] number of times. Finally you have to tel...
Compilable
For this Question: You are given two arrays - value and frequency both containing N elements. There is also a third array C which is currently empty. Then you perform N insertion operation in the array. For ith operation you insert value[i] to the end of the array frequency[i] number of times. Finally you have to tel...
Compilable
For this Question: You are given two arrays - value and frequency both containing N elements. There is also a third array C which is currently empty. Then you perform N insertion operation in the array. For ith operation you insert value[i] to the end of the array frequency[i] number of times. Finally you have to tel...
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 a binary array (a binary array is an array consisting only of zeroes and ones) of size N. You can do following operation on the array any number of times. In an operation you can select any subarray of size 3 of the array such that all three elements of that subarray are not same and replace th...
Compilable
For this Question: Given a binary array (a binary array is an array consisting only of zeroes and ones) of size N. You can do following operation on the array any number of times. In an operation you can select any subarray of size 3 of the array such that all three elements of that subarray are not same and replace th...
Compilable
For this Question: Given a binary array (a binary array is an array consisting only of zeroes and ones) of size N. You can do following operation on the array any number of times. In an operation you can select any subarray of size 3 of the array such that all three elements of that subarray are not same and replace th...
Compilable
For this Question: You are given a 2D array of axis- aligned rectangles. Each rectangle[i] = [x<sub>i</sub>1, y<sub>i</sub>1, x<sub>i</sub>2, y<sub>i</sub>2] denotes the ith rectangle where (x<sub>i</sub>1, y<sub>i</sub>1) are the coordinates of the bottom- left corner, and (x<sub>i</sub>2, y<sub>i</sub>2) are the coor...
Compilable
For this Question: Given a valid parenthesis string S. A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings. Decompose the strings S such that S = P1 + P2 +. . + Pk and there does not exist a way to split any of P1, P2,. . Pk into P = A + B, where A and B a...
Compilable
For this Question: Given a valid parenthesis string S. A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings. Decompose the strings S such that S = P1 + P2 +. . + Pk and there does not exist a way to split any of P1, P2,. . Pk into P = A + B, where A and B a...
Compilable
For this Question: You are given an array A of size N. You have to print the minimum of all the maximum elements in every <b>K- sized subarray</b> from the left to the right in array A. More formally, you have to print an integer which is the minimum of the maximum element in the subarray A<sub>i</sub>, A<sub>i+1</sub...
Compilable
For this Question: Given a valid parenthesis string S. A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings. Decompose the strings S such that S = P1 + P2 +. . + Pk and there does not exist a way to split any of P1, P2,. . Pk into P = A + B, where A and B a...
Compilable
For this Question: Given a valid parenthesis string S. A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings. Decompose the strings S such that S = P1 + P2 +. . + Pk and there does not exist a way to split any of P1, P2,. . Pk into P = A + B, where A and B a...
Compilable
For this Question: You are given an integer N. You need to create an integer A, such that the product of digits of A is equal to N and the value of A is minimum possible. Output -1 if no such answer exists.The first and the only line of input contains an integer N. 1 <= N <= 1000000000000000000 (10^18)Output a ...
Compilable
For this Question: You are given an integer N. You need to create an integer A, such that the product of digits of A is equal to N and the value of A is minimum possible. Output -1 if no such answer exists.The first and the only line of input contains an integer N. 1 <= N <= 1000000000000000000 (10^18)Output a ...
Compilable
For this Question: You are given an integer N. You need to create an integer A, such that the product of digits of A is equal to N and the value of A is minimum possible. Output -1 if no such answer exists.The first and the only line of input contains an integer N. 1 <= N <= 1000000000000000000 (10^18)Output a ...
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