
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

237 Views
In this problem, we are given three integer values, L, R, and k. Our task is to find numbers with K divisors in a given range. We will be finding the count of numbers in the range [L, R] that have exactly k divisors. We will be counting the 1 and the number itself as a divisor.Let’s take an example to understand the problem, Inputa = 3, b = 10, k = 4Output2ExplanationNumbers with exactly 3 divisors within the range 3 to 10 are 6 : divisors = 1, 2, 3, 6 8 : divisors = 1, 2, 4, 8Solution ... Read More

210 Views
In this problem, we are given three integer values, L, R, and k. Our task is to find numbers with K odd divisors in a given range. We will be finding the count of numbers in the range [L, R] that have exactly k divisors.We will be counting the 1 and the number itself as a divisor.Let’s take an example to understand the problem, Inputa = 3, b = 10, k = 3Output2ExplanationNumbers with exactly 3 divisors within the range 3 to 10 are 4 : divisors = 1, 2, 4 9 : divisors = 1, 3, 9Solution ApproachA simple ... Read More

313 Views
In this problem, we are given three arrays s1[] , s2[] and s3[] of size N, denoting N triangles. Our task is to find the number of unique triangles among given N triangles.For a triangle to be unique, all its side should be unique i.e. no other triangle should have the same sides.Let’s take an example to understand the problem, Inputs1[] = {1, 5, 3} s2[] = {2, 3, 2} s3[] = {4, 2, 5}Output1ExplanationTriangle with sides 1 2 4 is unique.Solution ApproachA simple solution to the problem is by counting the number of triangles which are unique.For this, we ... Read More

216 Views
In this problem, we are given two matrices mat1[][] and mat2[][] of the same size. Our task is to find the number of transformations to make two Matrices Equal.The transformation one matrices are −Select any matrix of the two matrices.Select a row or column from the matricesAdd 1 to all elements of the selected row or column.Let’s take an example to understand the problem, Inputmat1[][] = {{1 2} {2 1}} mat1[][] = {{2 3} {4 3}}Output3Explanation1 2 => 2 2 => 2 3 => 2 3 2 1 => 3 1 => 3 2 => 4 3Solution ApproachA simple solution ... Read More

369 Views
In this problem, we are given an array arr[] consisting of N elements. Our task is to find the subarray with even sum.Let’s take an example to understand the problem, Inputarr[] = {2, 1, 3, 4, 2, 5}Output28ExplanationThe subarrays are −{2}, {4}, {2}, {2, 4}, {2, 2}, {1, 3}, {1, 5}, {3, 5}, {4, 2}, {2, 1, 3}, {2, 1, 5}, {2, 3, 5}, {2, 4, 2}, {1, 3, 4}, {1, 3, 2}, {1, 4, 5}, {1, 2, 5}, {3, 4, 5}, {3, 2, 5}, {2, 1, 3, 4}, {2, 1, 3, 2}, {2, 3, 4, 5}, {2, 3, 2, ... Read More

347 Views
In this problem, we are given a linear equation of n variable for the form, coeff1(var1) + coeff2(var2) + … + coeffn(varn) = valueFind the number of solutions of a linear equation of n variables.Let’s take an example to understand the problem, Inputcoeff[] = {3, 1}, value = 4Output1ExplanationEquation : 3x + y = 4. Solution, x = 0, y = 4.Solution ApproachA simple solution to the problem is by evaluating the value of the equation. Then update the values by calling it recursively. If the value is 0, then solution count is 1. Else recur with value by subtracting ... Read More

205 Views
In this problem, we are given two dimensional arrays mat[n][m]. Our task is to find the number of positional elements.An element is said to be a positional element if the element is either maximum or minimum element of the row or column.Let’s take an example to understand the problem, Inputmat[][] = {2, 5, 7} {1, 3, 4} {5, 1, 3}Output8ExplanationElements 2, 5, 7, 1, 4, 5, 1, 3 are positional elements.Solution ApproachA simple solution to the problem is by storing the maximum and minimum element of each row and column. And then check for the condition and count the number.Program ... Read More

114 Views
In this problem, we are given two dimensional arrays mat[n][m]. Our task is to find the number of endless points in the matrix.Any point of the matrix is said to be endless if its next elements are 1. i.e.mat[i][j] is endless when mat[i+1][j] … mat[n][j] and mat[i][j+1] … mat[i][m] are 1.Let’s take an example to understand the problem, Inputmat[][] = {0, 0} {1, 1}Output2ExplanationElement mat[0][1] and mat[1][1] are endless.Solution ApproachA simple solution to the problem is by iterating all elements of the matrix. And for each element check if the current element is endless or not. If yes, increase count. ... Read More

6K+ Views
In this problem, we are given two arrays date1[] and date2 consisting of 3 integers which denote the DD-MM-YYYY of daes. Our task is to find the number of days between two given dates.Let’s take an example to understand the problem, Inputdate1[] = {13, 3, 2021}, date2[] = {24, 5, 2023}Output802ExplanationThe difference is 2 years , 2 months (3 - 5) and 11 days.2*356 + (30 + 31) + 11 = 802Solution ApproachA simple solution to the problem is by looping, starting from the start date date1 to date2 counting the number of days. And returning the value. This approach ... Read More

242 Views
In this problem, we are given an array divisors[] consisting of N integers which are the divisors of a number Num. Our task is to find the number from its divisors.The divisor array does not include 1 and the number.Let’s take an example to understand the problem, Inputdivisors[] = {3, 25, 5, 15}Output75ExplanationThe number 75 has divisors {3, 25, 5, 15}Solution ApproachTo solve the problem, we need to find the number Num using the smallest and largest divisors of the number.Num = smallest * largestFor this, we need to sort the array divisors[] and then find the product of elements ... Read More