Instruction
stringlengths
261
35k
Response
stringclasses
1 value
For this Question: Given an integer N, your task is to represent the given integer as a binary number.Input contains a single integer containing the value of N. Constraints:- 0 <= N <= 1000000000Print a string containing the binary representation of the given integer.Sample Input:- 9 Sample Output:- 1001 Sa...
Compilable
For this Question: Given an integer N, your task is to represent the given integer as a binary number.Input contains a single integer containing the value of N. Constraints:- 0 <= N <= 1000000000Print a string containing the binary representation of the given integer.Sample Input:- 9 Sample Output:- 1001 Sa...
Compilable
For this Question: Given an integer N, your task is to represent the given integer as a binary number.Input contains a single integer containing the value of N. Constraints:- 0 <= N <= 1000000000Print a string containing the binary representation of the given integer.Sample Input:- 9 Sample Output:- 1001 Sa...
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: Find the determinant of a 3*3 matrix1st 3 lines: 3 space separated values for matrixDeterminant of the matrixInput 1 2 3 2 3 4 3 4 8 Output: -3, I have written this Solution Code: import numpy as np a=np.array([input().strip().split() for _ in range(3)],int) ans=a[0][0]*(a[1][1]*a[2][2]-a[...
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: Natasha and Scott are playing a game with a single pile of stones. Initially the pile contains K stones. The players alternate turns, with Natasha starting first. In one move, the player can either add any odd number of stones to the pile or remove any odd number of stones from the pile. The rules ar...
Compilable
For this Question: Given an array <b>A</b> of <b>N</b> elements. Find the <b>majority</b> element in the array. A majority element in an array A of size N is an element that appears <b>more than N/2</b> times in the array.The first line of the input contains T denoting the number of testcases. The first line of the tes...
Compilable
For this Question: You are given an array a that contains N integers. All the integers in the array may not be distinct. The number of repetitions of each integer in the array is represented by ri. Your task is to print the integers in the decreasing order of their occurrence in the array. Note 1. If ri > rj, then...
Compilable
For this Question: You are given an array a that contains N integers. All the integers in the array may not be distinct. The number of repetitions of each integer in the array is represented by ri. Your task is to print the integers in the decreasing order of their occurrence in the array. Note 1. If ri > rj, then...
Compilable
For this Question: You are given an array a that contains N integers. All the integers in the array may not be distinct. The number of repetitions of each integer in the array is represented by ri. Your task is to print the integers in the decreasing order of their occurrence in the array. Note 1. If ri > rj, then...
Compilable
For this Question: You are given weights and values of N items, put some or all of these items in a knapsack of capacity W weight to get the maximum total value in the knapsack. Note that we have at most one quantity of each item. In other words, given two integer arrays val[0..(N-1)] and wt[0..(N-1)] which represent ...
Compilable
For this Question: You are given weights and values of N items, put some or all of these items in a knapsack of capacity W weight to get the maximum total value in the knapsack. Note that we have at most one quantity of each item. In other words, given two integer arrays val[0..(N-1)] and wt[0..(N-1)] which represent ...
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: 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: 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 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: Everyone has heard of palindromes, right! A palindrome is a string that remains the same if reversed. Let's define a new term, Dalindrome. A Dalindrome is a string whose atleast one of the substrings is a palindrome. Given a string, find whether it's a Dalindrome.The only line of input contains a...
Compilable
For this Question: Everyone has heard of palindromes, right! A palindrome is a string that remains the same if reversed. Let's define a new term, Dalindrome. A Dalindrome is a string whose atleast one of the substrings is a palindrome. Given a string, find whether it's a Dalindrome.The only line of input contains a...
Compilable
For this Question: Everyone has heard of palindromes, right! A palindrome is a string that remains the same if reversed. Let's define a new term, Dalindrome. A Dalindrome is a string whose atleast one of the substrings is a palindrome. Given a string, find whether it's a Dalindrome.The only line of input contains a...
Compilable
For this Question: Doctor Strange stumbles upon a rather curious artefact while spending holidays in Egypt. An antique board game but it can only be unlocked by a magical die. The only clue on the box is to get a sum of B by throwing the die A times. Help Doctor Strange if it is possible to get the particular sum. Prin...
Compilable
For this Question: Doctor Strange stumbles upon a rather curious artefact while spending holidays in Egypt. An antique board game but it can only be unlocked by a magical die. The only clue on the box is to get a sum of B by throwing the die A times. Help Doctor Strange if it is possible to get the particular sum. Prin...
Compilable
For this Question: Doctor Strange stumbles upon a rather curious artefact while spending holidays in Egypt. An antique board game but it can only be unlocked by a magical die. The only clue on the box is to get a sum of B by throwing the die A times. Help Doctor Strange if it is possible to get the particular sum. Prin...
Compilable
For this Question: For a given number N, Consider a table of N X N in which elements at the intersection of ith row and jth column are the product of i and j, i. e i x j. Also given a positive integer X. Your task is to count the number of elements in the table that contain the integer X.<b>User Task:</b> Since this...
Compilable
For this Question: For a given number N, Consider a table of N X N in which elements at the intersection of ith row and jth column are the product of i and j, i. e i x j. Also given a positive integer X. Your task is to count the number of elements in the table that contain the integer X.<b>User Task:</b> Since this...
Compilable
For this Question: For a given number N, Consider a table of N X N in which elements at the intersection of ith row and jth column are the product of i and j, i. e i x j. Also given a positive integer X. Your task is to count the number of elements in the table that contain the integer X.<b>User Task:</b> Since this...
Compilable
For this Question: For a given number N, Consider a table of N X N in which elements at the intersection of ith row and jth column are the product of i and j, i. e i x j. Also given a positive integer X. Your task is to count the number of elements in the table that contain the integer X.<b>User Task:</b> Since this...
Compilable
For this Question: You are given an equation: T<sub>n</sub> = 2*n + (n + 1)<sup>2</sup> - (n<sup>2</sup> + 4) Your task is to find S<sub>n</sub>: S<sub>n</sub> = T<sub>1</sub> + T<sub>2</sub> + T<sub>3</sub> +. .. . + T<sub>n</sub>User task: Since this is a functional problem, you don’t have to worry about the in...
Compilable
For this Question: You are given an equation: T<sub>n</sub> = 2*n + (n + 1)<sup>2</sup> - (n<sup>2</sup> + 4) Your task is to find S<sub>n</sub>: S<sub>n</sub> = T<sub>1</sub> + T<sub>2</sub> + T<sub>3</sub> +. .. . + T<sub>n</sub>User task: Since this is a functional problem, you don’t have to worry about the in...
Compilable
For this Question: You are given an equation: T<sub>n</sub> = 2*n + (n + 1)<sup>2</sup> - (n<sup>2</sup> + 4) Your task is to find S<sub>n</sub>: S<sub>n</sub> = T<sub>1</sub> + T<sub>2</sub> + T<sub>3</sub> +. .. . + T<sub>n</sub>User task: Since this is a functional problem, you don’t have to worry about the in...
Compilable
For this Question: You are given an equation: T<sub>n</sub> = 2*n + (n + 1)<sup>2</sup> - (n<sup>2</sup> + 4) Your task is to find S<sub>n</sub>: S<sub>n</sub> = T<sub>1</sub> + T<sub>2</sub> + T<sub>3</sub> +. .. . + T<sub>n</sub>User task: Since this is a functional problem, you don’t have to worry about the in...
Compilable
For this Question: Pino is super fond of candies. Today she has A chocolate candies, B orange candies, and C unknown candies. You are also given the happiness she gets after eating a particular candy. She wants to have exactly X chocolate candies and Y orange candies. She can transform an unknown candy into a candy o...
Compilable
For this Question: Pino is super fond of candies. Today she has A chocolate candies, B orange candies, and C unknown candies. You are also given the happiness she gets after eating a particular candy. She wants to have exactly X chocolate candies and Y orange candies. She can transform an unknown candy into a candy o...
Compilable
For this Question: Pino is super fond of candies. Today she has A chocolate candies, B orange candies, and C unknown candies. You are also given the happiness she gets after eating a particular candy. She wants to have exactly X chocolate candies and Y orange candies. She can transform an unknown candy into a candy o...
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 N integers, give the number with maximum frequency. If multiple numbers have maximum frequency print the maximum number among them.The first line of the input contains an integer N, and the Second line contains N space-separated integers of the array. <b>Constraints:</b> 3 <= N ...
Compilable
For this Question: Given an array of N integers, give the number with maximum frequency. If multiple numbers have maximum frequency print the maximum number among them.The first line of the input contains an integer N, and the Second line contains N space-separated integers of the array. <b>Constraints:</b> 3 <= N ...
Compilable
For this Question: Given an array of N integers, give the number with maximum frequency. If multiple numbers have maximum frequency print the maximum number among them.The first line of the input contains an integer N, and the Second line contains N space-separated integers of the array. <b>Constraints:</b> 3 <= N ...
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: How would you add your own method to the Array object so the following code would work? const arr = [1, 2, 3] console. log(arr.average()) // 2input will be an array, run like this const anyArray = [5,6...] anyArray.average should return average of the arraysAverage of the given arrayconst myAr...
Compilable
For this Question: You are given N intervals, the i<sup>th</sup> of them being [A<sub>i</sub>, B<sub>i</sub>], where A<sub>i</sub> and B<sub>i</sub> are positive integers. Let the union of all these intervals be S. It is easy to see that S can be uniquely represented as an union of disjoint closed intervals. Your task ...
Compilable
For this Question: For an integer N, your task is to calculate sum of first N natural numbers.<b>User Task:</b> Since this will be a functional problem, you don't have to worry about input. You just have to complete the function <b>sum()</b> which takes the integer N as a parameter. Constraints: 1 <= N < = 1000000...
Compilable
For this Question: Find the number of strings of length N, such that the character 'a' occurs at least once in the string and the string consists of lowercase letters of the english alphabet only. As the answer can be large, output it modulo 10<sup>9</sup>+7.The first and the only line of input contains an integer N...
Compilable
For this Question: Find the number of strings of length N, such that the character 'a' occurs at least once in the string and the string consists of lowercase letters of the english alphabet only. As the answer can be large, output it modulo 10<sup>9</sup>+7.The first and the only line of input contains an integer N...
Compilable
For this Question: Find the number of strings of length N, such that the character 'a' occurs at least once in the string and the string consists of lowercase letters of the english alphabet only. As the answer can be large, output it modulo 10<sup>9</sup>+7.The first and the only line of input contains an integer N...
Compilable
For this Question: Given an array Arr of length N. Print the lexographically minimum rotation of the array Arr. All the elements of the array are distinct.First line of input contains a single integer N. Second line of input contains N integers denoting the array Arr. Constraints: 1 <= N <= 100000 1 <= Arr[i] <=...
Compilable
For this Question: Given an array Arr of length N. Print the lexographically minimum rotation of the array Arr. All the elements of the array are distinct.First line of input contains a single integer N. Second line of input contains N integers denoting the array Arr. Constraints: 1 <= N <= 100000 1 <= Arr[i] <=...
Compilable
For this Question: Given an array Arr of length N. Print the lexographically minimum rotation of the array Arr. All the elements of the array are distinct.First line of input contains a single integer N. Second line of input contains N integers denoting the array Arr. Constraints: 1 <= N <= 100000 1 <= Arr[i] <=...
Compilable
For this Question: Given two elements A and B, your task is to swap the given two elements.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Swap(int A, int B)</b>.Print one line which contains the output of swapped elements.Sample Input:...
Compilable
For this Question: Given two elements A and B, your task is to swap the given two elements.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Swap(int A, int B)</b>.Print one line which contains the output of swapped elements.Sample Input:...
Compilable
For this Question: Given a double linked list consisting of N nodes, your task is to reverse the linked list and return the head of the modified list.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Reverse()</b> that takes head node of ...
Compilable
For this Question: You are given a Doubly linked list and an integer K . Your task is to insert the integer K at the head of the given linked list<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>insertnew()</b> that takes the head node ...
Compilable
For this Question: You are given an array and Q queries. Your 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: Mahesh has won some money K from a lottery, he wants to distribute the money among his three sisters. His sisters already have some money with them. Let's say they have x, y, z amount of money. Now mahesh wants to distribute his money such that all the sisters have the same amount of total money left...
Compilable
For this Question: Mahesh has won some money K from a lottery, he wants to distribute the money among his three sisters. His sisters already have some money with them. Let's say they have x, y, z amount of money. Now mahesh wants to distribute his money such that all the sisters have the same amount of total money left...
Compilable
For this Question: Mahesh has won some money K from a lottery, he wants to distribute the money among his three sisters. His sisters already have some money with them. Let's say they have x, y, z amount of money. Now mahesh wants to distribute his money such that all the sisters have the same amount of total money left...
Compilable
For this Question: Mahesh has won some money K from a lottery, he wants to distribute the money among his three sisters. His sisters already have some money with them. Let's say they have x, y, z amount of money. Now mahesh wants to distribute his money such that all the sisters have the same amount of total money left...
Compilable
For this Question: We have a string S consisting of uppercase English letters. Additionally, an integer N will be given. Shift each character of S by N in alphabetical order (see below), and print the resulting string. We assume that A follows Z. For example, shifting A by 2 results in C (A → B → C), and shifting Y...
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: Given a double linked list consisting of N nodes, your task is to reverse the linked list and return the head of the modified list.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Reverse()</b> that takes head node of ...
Compilable
For this Question: Given a String <b>S</b>, you need to typecast this String to Integer. If the typecasting is done successfully then we will print "<b>Nice Job</b>" otherwise "<b>Wrong answer</b>".User task: Since this is a functional problem you don't have to worry about the input. You just have to complete the func...
Compilable
For this Question: Given a String <b>S</b>, you need to typecast this String to Integer. If the typecasting is done successfully then we will print "<b>Nice Job</b>" otherwise "<b>Wrong answer</b>".User task: Since this is a functional problem you don't have to worry about the input. You just have to complete the func...
Compilable
For this Question: You are given two strings S and T consisting of lowercase English letters. Determine if S is a prefix of T.The input contains two strings separated by a new line. S T <b>Constraints</b> S and T are strings of lengths between 1 and 100 (inclusive) consisting of lowercase English letters.Print "Y...
Compilable
For this Question: You are given N ropes of L[i] lengths, you need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. The task is to connect the ropes with minimum cost.The first line of input contains an integer T denoting the number of test cases. The first line of e...
Compilable
For this Question: You are given N ropes of L[i] lengths, you need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. The task is to connect the ropes with minimum cost.The first line of input contains an integer T denoting the number of test cases. The first line of e...
Compilable
For this Question: You are given N ropes of L[i] lengths, you need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. The task is to connect the ropes with minimum cost.The first line of input contains an integer T denoting the number of test cases. The first line of e...
Compilable
For this Question: A 2n digits number is said to be lucky if sum of n most significant digits is equal to sum of n least significant digits. Given a number find out if the number is lucky or not?First line contains n. Next line contains a number of 2n digits. <b>Constraints</b> 1 ≤ n ≤ 10<sup>5</sup> Number co...
Compilable
For this Question: Given two elements A and B, your task is to swap the given two elements.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Swap(int A, int B)</b>.Print one line which contains the output of swapped elements.Sample Input:...
Compilable
For this Question: Given two elements A and B, your task is to swap the given two elements.<b>User Task:</b> Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Swap(int A, int B)</b>.Print one line which contains the output of swapped elements.Sample Input:...
Compilable
For this Question: Given a string of length N. You have to select two non- overlapping (no common index) non- empty substrings of odd lengths from that string such that both those substrings are palindrome. You want the product of lengths of those substring to be maximum.Input contains of a single String of length N. ...
Compilable
For this Question: Given a string of length N. You have to select two non- overlapping (no common index) non- empty substrings of odd lengths from that string such that both those substrings are palindrome. You want the product of lengths of those substring to be maximum.Input contains of a single String of length N. ...
Compilable
For this Question: Given a string of length N. You have to select two non- overlapping (no common index) non- empty substrings of odd lengths from that string such that both those substrings are palindrome. You want the product of lengths of those substring to be maximum.Input contains of a single String of length N. ...
Compilable
For this Question: Given an integer K and an array height[] of size N, where height[i] denotes the height of the ith tree in a forest. The task is to make a cut of height X from the ground such that at max K units wood is collected. Find the minimum value of X <b>If you make a cut of height X from the ground then ever...
Compilable
For this Question: Given an integer K and an array height[] of size N, where height[i] denotes the height of the ith tree in a forest. The task is to make a cut of height X from the ground such that at max K units wood is collected. Find the minimum value of X <b>If you make a cut of height X from the ground then ever...
Compilable
For this Question: Given an integer K and an array height[] of size N, where height[i] denotes the height of the ith tree in a forest. The task is to make a cut of height X from the ground such that at max K units wood is collected. Find the minimum value of X <b>If you make a cut of height X from the ground then ever...
Compilable
For this Question: Insertion is a basic but frequently used operation. Arrays in most languages cannnot be dynamically shrinked or expanded. Here, we will work with such arrays and try to insert an element at the end of array. You are given an array arr. The size of the array is N. You need to insert an element at ...
Compilable
For this Question: Insertion is a basic but frequently used operation. Arrays in most languages cannnot be dynamically shrinked or expanded. Here, we will work with such arrays and try to insert an element at the end of array. You are given an array arr. The size of the array is N. You need to insert an element at ...
Compilable
For this Question: Insertion is a basic but frequently used operation. Arrays in most languages cannnot be dynamically shrinked or expanded. Here, we will work with such arrays and try to insert an element at the end of array. You are given an array arr. The size of the array is N. You need to insert an element at ...
Compilable
For this Question: Given a sorted array arr[] of N integers and a number K is given. The task is to check if the element K is present in the array or not. <b>Note:</b> Use binary search to solve the problemThe first line of input contains a number of test cases T. For each test case, the first line of input contains a...
Compilable
For this Question: Given a sorted array arr[] of N integers and a number K is given. The task is to check if the element K is present in the array or not. <b>Note:</b> Use binary search to solve the problemThe first line of input contains a number of test cases T. For each test case, the first line of input contains a...
Compilable
For this Question: Given a sorted array arr[] of N integers and a number K is given. The task is to check if the element K is present in the array or not. <b>Note:</b> Use binary search to solve the problemThe first line of input contains a number of test cases T. For each test case, the first line of input contains a...
Compilable
For this Question: Given a sorted array arr[] of N integers and a number K is given. The task is to check if the element K is present in the array or not. <b>Note:</b> Use binary search to solve the problemThe first line of input contains a number of test cases T. For each test case, the first line of input contains a...
Compilable
For this Question: While Solo was enjoying her daddy's party, her little sister Tono gave her the following problem to solve: Given an array A of N integers, find the number of occurrences of the maximum integer in the array. As Solo is small and enjoying the party, please help her solve this problem.The first line...
Compilable
For this Question: While Solo was enjoying her daddy's party, her little sister Tono gave her the following problem to solve: Given an array A of N integers, find the number of occurrences of the maximum integer in the array. As Solo is small and enjoying the party, please help her solve this problem.The first line...
Compilable