Instruction
stringlengths
261
35k
Response
stringclasses
1 value
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
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
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
For this Question: Given a BST containing N nodes. The task is to find the <b>minimum absolute difference</b> possible between any <b>two different nodes</b>.<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>absMinDist()</b> that takes "ro...
Compilable
For this Question: Given a BST containing N nodes. The task is to find the <b>minimum absolute difference</b> possible between any <b>two different nodes</b>.<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>absMinDist()</b> that takes "ro...
Compilable
For this Question: Write a function called lucky_sevens which takes an array of integers and returns true if any three consecutive elements sum to 7An array containing numbers.Print true if such triplet exists summing to 7 else print falseSample input:- [2, 1, 5, 1, 0] [1, 6] Sample output:- true false Explan...
Compilable
For this Question: Write a program to print Five stars ('*') <b><i>vertically</i></b> and 5 <b><i>horizontally</i></b> There will be two functions: <ul> <li>verticalFive(): Print stars in vertical order</li> <li>horizontalFive(): Print stars in horizontal order</l> </ul><b>User Task:</b> Your task is to complet...
Compilable
For this Question: Write a program to print Five stars ('*') <b><i>vertically</i></b> and 5 <b><i>horizontally</i></b> There will be two functions: <ul> <li>verticalFive(): Print stars in vertical order</li> <li>horizontalFive(): Print stars in horizontal order</l> </ul><b>User Task:</b> Your task is to complet...
Compilable
For this Question: Write a class with the name SumCalculator. The class needs two fields (public variables) with names num1 and num2 both of type int. Write the following methods (instance methods): <b>*Method named sum without any parameters, it needs to return the value of num1 + num2.</b> <b>*Method named sum2 ...
Compilable
For this Question: Write a class with the name SumCalculator. The class needs two fields (public variables) with names num1 and num2 both of type int. Write the following methods (instance methods): <b>*Method named sum without any parameters, it needs to return the value of num1 + num2.</b> <b>*Method named sum2 ...
Compilable
For this Question: Given an array of positive integers. The task is to find inversion count of array. Inversion Count : For an array, inversion count indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion c...
Compilable
For this Question: Given an array of positive integers. The task is to find inversion count of array. Inversion Count : For an array, inversion count indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion c...
Compilable
For this Question: Find if the given sentence end with the given word1st line: Sentence 2nd line: Word which has to be in endPrint True or False if the sentence ends with the wordInput: The world is small small Output: True, I have written this Solution Code: import re s=input() w=input() st=".*"+w+"$" x = r...
Compilable
For this Question: Given two strings a and b consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, “act” and “tac” are...
Compilable
For this Question: Given two strings a and b consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, “act” and “tac” are...
Compilable
For this Question: Given two strings a and b consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, “act” and “tac” are...
Compilable
For this Question: Given two strings a and b consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, “act” and “tac” are...
Compilable
For this Question: You are given a grid having N*M elements. Find the index of the row (1-base indexing) which has the maximum sum of elements. Note: if more than two rows have the same sum of elements, then return the smallest index.The first line of the input contains two integers N and M. The next N lines each con...
Compilable
For this Question: You are given a grid having N*M elements. Find the index of the row (1-base indexing) which has the maximum sum of elements. Note: if more than two rows have the same sum of elements, then return the smallest index.The first line of the input contains two integers N and M. The next N lines each con...
Compilable
For this Question: Sara loves problems on permutation but this time she stuck on a problem and asks for your help. Given a permutation of N integers as Arr[], your task is to check for each K(1 <= K <= N) there exists a subarray of size K such that it is also a permutation of K integers. Note:- A permutation of N i...
Compilable
For this Question: Sara loves problems on permutation but this time she stuck on a problem and asks for your help. Given a permutation of N integers as Arr[], your task is to check for each K(1 <= K <= N) there exists a subarray of size K such that it is also a permutation of K integers. Note:- A permutation of N i...
Compilable
For this Question: Sara loves problems on permutation but this time she stuck on a problem and asks for your help. Given a permutation of N integers as Arr[], your task is to check for each K(1 <= K <= N) there exists a subarray of size K such that it is also a permutation of K integers. Note:- A permutation of N i...
Compilable
For this Question: You are given a cubic dice with 6 faces. All the individual faces have numbers printed on them. The numbers are in the range of 1 to 6, like any <b>ordinary dice</b>. You will be provided with a face of this cube, your task is to find the number on the opposite face of the cube. <b>Note</b>:- The ...
Compilable
For this Question: You are given a cubic dice with 6 faces. All the individual faces have numbers printed on them. The numbers are in the range of 1 to 6, like any <b>ordinary dice</b>. You will be provided with a face of this cube, your task is to find the number on the opposite face of the cube. <b>Note</b>:- The ...
Compilable
For this Question: You are given a cubic dice with 6 faces. All the individual faces have numbers printed on them. The numbers are in the range of 1 to 6, like any <b>ordinary dice</b>. You will be provided with a face of this cube, your task is to find the number on the opposite face of the cube. <b>Note</b>:- The ...
Compilable
For this Question: You are given a cubic dice with 6 faces. All the individual faces have numbers printed on them. The numbers are in the range of 1 to 6, like any <b>ordinary dice</b>. You will be provided with a face of this cube, your task is to find the number on the opposite face of the cube. <b>Note</b>:- The ...
Compilable
For this Question: Given an array of N elements and an integer D. Your task is to rotate the array D times in a circular manner from the right to left direction. Consider the examples for better understanding:- Try to do without creating another arrayUser task: Since this will be a functional problem, you don't have ...
Compilable
For this Question: Find the Highest Common divisor (H.C.F) between N and M.<b>User Task</b> Since this is a functional problem, you don't have to worry about the input. You just have to complete the function <i>HCF()</i> which contains the given number N and P. <b>Constraints:</b> 1 <= N, P <= 10<sup>5</sup> <b...
Compilable
For this Question: Given a sorted array <b>arr[]</b> of size <b>N</b> without duplicates, and given a value <b>x</b>. Find the floor of x in given array. Floor of x is defined as the largest element K in arr[] such that K is smaller than or equal to x. Try to use binary search to solve this problem.First line of inp...
Compilable
For this Question: Given a sorted array <b>arr[]</b> of size <b>N</b> without duplicates, and given a value <b>x</b>. Find the floor of x in given array. Floor of x is defined as the largest element K in arr[] such that K is smaller than or equal to x. Try to use binary search to solve this problem.First line of inp...
Compilable
For this Question: Given a sorted array <b>arr[]</b> of size <b>N</b> without duplicates, and given a value <b>x</b>. Find the floor of x in given array. Floor of x is defined as the largest element K in arr[] such that K is smaller than or equal to x. Try to use binary search to solve this problem.First line of inp...
Compilable
For this Question: 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: 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: 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: There is a function F defined as, F(x) = GCD(1, x) + GCD(2, x) +. . + GCD(x, x) Your task is to find F(x), for the given x.First line contain integer T denoting number of test cases. Next t lines contain an integer x. Constraints 1 <= T <= 20000 1 <= x <= 100000For each test case print F(n)...
Compilable
For this Question: There is a function F defined as, F(x) = GCD(1, x) + GCD(2, x) +. . + GCD(x, x) Your task is to find F(x), for the given x.First line contain integer T denoting number of test cases. Next t lines contain an integer x. Constraints 1 <= T <= 20000 1 <= x <= 100000For each test case print F(n)...
Compilable
For this Question: There is a function F defined as, F(x) = GCD(1, x) + GCD(2, x) +. . + GCD(x, x) Your task is to find F(x), for the given x.First line contain integer T denoting number of test cases. Next t lines contain an integer x. Constraints 1 <= T <= 20000 1 <= x <= 100000For each test case print F(n)...
Compilable
For this Question: You are given Q queries. Each query consists of a single number N. You can perform any one of the 2 operations in a single move: 1: If we take 2 integers a and b where, N=a*b, (a and b are not equal to 1), then we can change N=max(a,b) 2: Decrease the value of N by 1 . For each query determine th...
Compilable
For this Question: You are given Q queries. Each query consists of a single number N. You can perform any one of the 2 operations in a single move: 1: If we take 2 integers a and b where, N=a*b, (a and b are not equal to 1), then we can change N=max(a,b) 2: Decrease the value of N by 1 . For each query determine th...
Compilable
For this Question: Given two positive integers B and A, find the smallest integer height such that there exists a Triangle with base B and area atleast A.The first line of input contains a single integer T, denoting the number of testcases. Each test case contains only one line i.e. B(base) and A(area) separated by spa...
Compilable
For this Question: Given two positive integers B and A, find the smallest integer height such that there exists a Triangle with base B and area atleast A.The first line of input contains a single integer T, denoting the number of testcases. Each test case contains only one line i.e. B(base) and A(area) separated by spa...
Compilable
For this Question: You will be given an array of several arrays that each contain integers and your goal is to write a function that will sum up all the numbers in all the arrays. For example, if the input is [[3, 2], [1], [4, 12]] then your program should output 22 because 3 + 2 + 1 + 4 + 12 = 22An array containing ...
Compilable
For this Question: Alex always skips math class. As a punishment, his teacher has given him an array of size n where every number except one is the power of x. Being poor in mathematics, Alex has asked for your help to solve the problem. Can you help him to find the bad number which is not a power of x? <b>NOTE:</b...
Compilable
For this Question: Alex always skips math class. As a punishment, his teacher has given him an array of size n where every number except one is the power of x. Being poor in mathematics, Alex has asked for your help to solve the problem. Can you help him to find the bad number which is not a power of x? <b>NOTE:</b...
Compilable
For this Question: Alex always skips math class. As a punishment, his teacher has given him an array of size n where every number except one is the power of x. Being poor in mathematics, Alex has asked for your help to solve the problem. Can you help him to find the bad number which is not a power of x? <b>NOTE:</b...
Compilable
For this Question: Given two strings X and Y containing both uppercase and lowercase alphabets. The task is to find the length of the longest common substring.Input consist of two lines containing the strings X and Y respectively. 1 <= length(X), length(Y) <= 100Print in a single line the length of the longest commo...
Compilable
For this Question: Given two strings X and Y containing both uppercase and lowercase alphabets. The task is to find the length of the longest common substring.Input consist of two lines containing the strings X and Y respectively. 1 <= length(X), length(Y) <= 100Print in a single line the length of the longest commo...
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: Piyush has N chocolates in his extremely huge bag. He wants to buy some chocolates (maybe 0) so that the total number of chocolates he has in his bag can never be fairly divided into piles. A division is considered fair if there are at least 2 piles and each pile has more than 1 chocolate. Moreover...
Compilable
For this Question: Piyush has N chocolates in his extremely huge bag. He wants to buy some chocolates (maybe 0) so that the total number of chocolates he has in his bag can never be fairly divided into piles. A division is considered fair if there are at least 2 piles and each pile has more than 1 chocolate. Moreover...
Compilable
For this Question: Piyush has N chocolates in his extremely huge bag. He wants to buy some chocolates (maybe 0) so that the total number of chocolates he has in his bag can never be fairly divided into piles. A division is considered fair if there are at least 2 piles and each pile has more than 1 chocolate. Moreover...
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: Rick has got a huge candy bag. The bag contains a total of O orange candies, A apple candies, and U candies with an unknown flavor (can be orange or apple as well). Now Morty wants to know the maximum number of candies that can be drawn from the bag blindfolded such that no more than X orange and Y...
Compilable
For this Question: Rick has got a huge candy bag. The bag contains a total of O orange candies, A apple candies, and U candies with an unknown flavor (can be orange or apple as well). Now Morty wants to know the maximum number of candies that can be drawn from the bag blindfolded such that no more than X orange and Y...
Compilable
For this Question: Rick has got a huge candy bag. The bag contains a total of O orange candies, A apple candies, and U candies with an unknown flavor (can be orange or apple as well). Now Morty wants to know the maximum number of candies that can be drawn from the bag blindfolded such that no more than X orange and Y...
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: Given an integer N, your task is to check whether the given number is prime or notThe input contains a single integer N. Constraints:- 1 <= N <= 100000000000Print "YES" If the given number is prime else print "NO".Sample Input:- 2 Sample Output:- YES Sample Input:- 4 Sample Output:- ...
Compilable
For this Question: Given an integer N, your task is to check whether the given number is prime or notThe input contains a single integer N. Constraints:- 1 <= N <= 100000000000Print "YES" If the given number is prime else print "NO".Sample Input:- 2 Sample Output:- YES Sample Input:- 4 Sample Output:- ...
Compilable
For this Question: Given an integer N, your task is to check whether the given number is prime or notThe input contains a single integer N. Constraints:- 1 <= N <= 100000000000Print "YES" If the given number is prime else print "NO".Sample Input:- 2 Sample Output:- YES Sample Input:- 4 Sample Output:- ...
Compilable
For this Question: 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: <b> The only difference between the easy and the tricky version is the constraint on the number of queries Q. Solving the tricky version automatically solves the easy version.</b> You are given an array A of N integers. You will be given Q queries with two integers L and R. For each query, you ne...
Compilable
For this Question: <b> The only difference between the easy and the tricky version is the constraint on the number of queries Q. Solving the tricky version automatically solves the easy version.</b> You are given an array A of N integers. You will be given Q queries with two integers L and R. For each query, you ne...
Compilable
For this Question: <b> The only difference between the easy and the tricky version is the constraint on the number of queries Q. Solving the tricky version automatically solves the easy version.</b> You are given an array A of N integers. You will be given Q queries with two integers L and R. For each query, you ne...
Compilable
For this Question: A message containing letters from A - Z is been encoded to numbers using the alphabetical order of the number i. e A - > 1, B - > 2,. , Z - >26. Given the encoded message your task is to print the number of ways the message can be decoded.Input contains a single line containing the string S. Con...
Compilable
For this Question: A message containing letters from A - Z is been encoded to numbers using the alphabetical order of the number i. e A - > 1, B - > 2,. , Z - >26. Given the encoded message your task is to print the number of ways the message can be decoded.Input contains a single line containing the string S. Con...
Compilable
For this Question: Given a positive integer N, construct a string of length N such that no two adjacent characters are the same. Among all possible strings, find the lexicographically minimum string. Note: You can use only lowercase characters from 'a' to 'z'.The first and only line of input contains an integer N. ...
Compilable
For this Question: Given a positive integer N, construct a string of length N such that no two adjacent characters are the same. Among all possible strings, find the lexicographically minimum string. Note: You can use only lowercase characters from 'a' to 'z'.The first and only line of input contains an integer N. ...
Compilable
For this Question: Given a positive integer N, construct a string of length N such that no two adjacent characters are the same. Among all possible strings, find the lexicographically minimum string. Note: You can use only lowercase characters from 'a' to 'z'.The first and only line of input contains an integer N. ...
Compilable
For this Question: Given an array A[] and a range [a, b]. The task is to partition the array around the range such that array is divided into three parts. 1) All elements smaller than a come first. 2) All elements in range a to b come next. 3) All elements greater than b appear in the end. The individual elements o...
Compilable
For this Question: Given an array A[] and a range [a, b]. The task is to partition the array around the range such that array is divided into three parts. 1) All elements smaller than a come first. 2) All elements in range a to b come next. 3) All elements greater than b appear in the end. The individual elements o...
Compilable
For this Question: You are given three distinct positive integers, A, B and C, in the input. Your task is to find their median. The median of a set of integers is the number at the middle position if they are arranged in ascending order.The input consists of a single line containing three integers A, B and C. <b...
Compilable
For this Question: You are given three distinct positive integers, A, B and C, in the input. Your task is to find their median. The median of a set of integers is the number at the middle position if they are arranged in ascending order.The input consists of a single line containing three integers A, B and C. <b...
Compilable
For this Question: You are given three distinct positive integers, A, B and C, in the input. Your task is to find their median. The median of a set of integers is the number at the middle position if they are arranged in ascending order.The input consists of a single line containing three integers A, B and C. <b...
Compilable
For this Question: Given 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 of citations (each citation is a non-negative integer) of a researcher, write a program to compute the researcher's h-index. According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h pap...
Compilable
For this Question: Given an array of citations (each citation is a non-negative integer) of a researcher, write a program to compute the researcher's h-index. According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h pap...
Compilable
For this Question: Given a linked list consisting of N nodes, your task is to traverse the list and print its 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>printList()</b> that takes head node of the linked list as parameter....
Compilable
For this Question: Abhas likes to play with numbers. He is given integers N and K. Find the number of triples (a, b, c) of positive integers not greater than N such that a+b, b+c, and c+a are all multiples of K. The order of a, b, and c does matter, and some of them can be the same.The input line contains N and K separ...
Compilable
For this Question: Walter white is considered very intelligent person. He has a problem to solve. As he is suffering from cancer, can you help him solve it? Given two integer arrays C and S of length c and s respectively. Index i of array S can be considered good if a subarray of length c can be formed starting from...
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: Separate chaining technique in hashing allows us to use a linked list at each hash slot to handle the problem of collisions. That is, every slot of the hash table is a linked list, so whenever a collision occurs, the element can be appened as a node to the linked list at the slot. In this question...
Compilable
For this Question: Separate chaining technique in hashing allows us to use a linked list at each hash slot to handle the problem of collisions. That is, every slot of the hash table is a linked list, so whenever a collision occurs, the element can be appened as a node to the linked list at the slot. In this question...
Compilable
For this Question: Separate chaining technique in hashing allows us to use a linked list at each hash slot to handle the problem of collisions. That is, every slot of the hash table is a linked list, so whenever a collision occurs, the element can be appened as a node to the linked list at the slot. In this question...
Compilable
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:- a) First element is replaced by multiplication of first and second. b) Last element is replaced by multiplication of last and second last. See example ...
Compilable
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:- a) First element is replaced by multiplication of first and second. b) Last element is replaced by multiplication of last and second last. See example ...
Compilable
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:- a) First element is replaced by multiplication of first and second. b) Last element is replaced by multiplication of last and second last. See example ...
Compilable
For this Question: Given an array of N elements, your task is to update every element with multiplication of previous and next elements with following exceptions:- a) First element is replaced by multiplication of first and second. b) Last element is replaced by multiplication of last and second last. See example ...
Compilable
For this Question: Numbers are awesome, larger numbers are more awesome! Given an array A of size N, you need to find the maximum sum that can be obtained from the elements of the array (the selected elements need not be contiguous). You may even decide to take no element to get a sum of 0.The first line of the input ...
Compilable