Given four integers x1, y1, x2 and y2, which represents two coordinates (x1, y1) and (x2, y2) of a two-dimensional graph. The task is to find the Euclidean distance between these two points.Euclidean distance between two points is the length of a straight line drawn between those two given points.Attention reader! Don’t stop learning now. […]

Continue ReadingGiven two positive integers N and S. The task is to minimize the number of increments on N (N = N + 1) required to make the sum of digits of N less than or equal to S. NOTE: N can range up to an18 digit number and 1

Continue ReadingGiven two integers N and M, the task is to calculate the minimum number of operations required to reduce N to 0 using the following operations:Replace N with (N/M).Increment the value of M by 1.Example:Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at […]

Continue ReadingGiven three strings D, M, and Y representing a date. The task is to check whether concatenation of date and month results in the same digits as of the year. Examples:Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a […]

Continue ReadingGiven an array arr[], the task is to print the indices that have the highest probability of holding the entire sum of the array after performing the given operations: Choose any two elements say arr[i] and arr[j], store their sum in a variable KAssign K at index of max(arr[i], arr[j]) and assign 0 at index of […]

Continue ReadingGiven a binary array arr[] and an integer K, the task is to count the maximum number of 0’s that can be flipped to 1’s such that there are at least K 0’s between two 1’s.Example:Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course […]

Continue ReadingGiven three integers a, b and c which denotes the frequencies of three different characters ‘A‘, ‘B‘, and ‘C‘ respectively, and can be used to form strings of length 3. The task is to count the total number of possible combinations of A, B and C such that it forms a string having at least […]

Continue ReadingGiven area of square inscribed in a circle as N, the task is to calculate the area of circle in which the square is inscribed.Examples: Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your […]

Continue ReadingGiven a binary array arr1[] and an integer array arr2[], each of length N, the task is to rearrange the elements in the array arr2 such that the total cost generated is maximized. The total cost generated is calculated by summation of modified values in the arr2 array. The values are modified in such a […]

Continue ReadingGiven an array arr[] of size N, the task is to find the value of an integer K such that its repeated subtraction from array elements will make all array elements in minimum operations.Example:Input: arr[] = {5, 3, 3, 7}Output: 2Explanation: Minimum 2 operations must be performed:1st operation: subtract 2 from elements at indices {0, […]

Continue Reading