Server Side Programming Articles

Page 1270 of 2109

Maximum of smallest possible area that can get with exactly k cut of given rectangular in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 197 Views

In this tutorial, we will be discussing a program to find the maximum of smallest possible area that can get with exactly k cut of given rectangular.For this we will be provided with the sides of the rectangle and the number of cuts that can be made. Our task is to calculate the smallest area that can be achieved by making the given number of cuts.Example#include using namespace std; void max_area(int n, int m, int k) {    if (k > (n + m - 2))       cout

Read More

Maximum of sum and product of digits until number is reduced to a single digit in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 345 Views

In this tutorial, we will be discussing a program to find maximum of sum and product of digits until number is reduced to a single digitFor this we will be provided with a random number. Our task is to find and print out the maximum of sum and product of the digits of the given number until it coverts to a single digitExample#include using namespace std; //converting number to single digit by adding long repeatedSum(long n) {    if (n == 0)       return 0;    return (n % 9 == 0) ? 9 : (n % 9); ...

Read More

Maximum parent children sum in Binary tree in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 305 Views

In this tutorial, we will be discussing a program to find maximum parent children sum in Binary treeFor this we will be provided with a binary tree. Our task is to add up the parent node with its children nodes and finally find the maximum of all of that and print it out.Example#include using namespace std; struct Node {    int data;    struct Node *left, *right; }; //inserting nodes struct Node* newNode(int n) {    struct Node* root = new Node();    root->data = n;    root->left = root->right = NULL;    return root; } int maxSum(struct Node* ...

Read More

Maximum path sum for each position with jumps under divisibility condition in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 169 Views

In this tutorial, we will be discussing a program to find maximum path sum for each position with jumps under divisibility conditionFor this we will be provided with an array of n random integers. Our task is to jump from one position to another if it divides it and finally provide the maximum sum path for every given position.Example#include using namespace std; //finding maximum sum path void printMaxSum(int arr[], int n) {    int dp[n];    memset(dp, 0, sizeof dp);    for (int i = 0; i < n; i++) {       dp[i] = arr[i];     ...

Read More

Maximum path sum that starting with any cell of 0-th row and ending with any cell of (N-1)-th row in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 230 Views

In this tutorial, we will be discussing a program to find maximum path sum that starting with any cell of 0-th row and ending with any cell of (N-1)-th rowFor this we will be provided with a matrix with possible moves of (i+1, j), (i+1, j-1), (i+1, j+1). Our task is to start from zeroth position and move to last row finding out the maximum sum path.Example#include using namespace std; #define N 4 //finding maximum sum path int MaximumPath(int Mat[][N]) {    int result = 0 ;    int dp[N][N+2];    memset(dp, 0, sizeof(dp));    for (int i = 0 ...

Read More

Maximum points collected by two persons allowed to meet once in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 179 Views

In this tutorial, we will be discussing a program to find maximum points collected by two persons allowed to meet onceFor this we will be provided with a matrix with cells containing points. Our task is to find the path when two people starting from two corners meet such that they are having maximum points collected.Example#include #define M 3 #define N 3 using namespace std; int findMaxPoints(int A[][M]) {    //storing points    int P1S[M+1][N+1], P1E[M+1][N+1];    memset(P1S, 0, sizeof(P1S));    memset(P1E, 0, sizeof(P1E));    int P2S[M+1][N+1], P2E[M+1][N+1];    memset(P2S, 0, sizeof(P2S));    memset(P2E, 0, sizeof(P2E));    for (int i=1; ...

Read More

Maximum points covered after removing an Interval in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 305 Views

In this tutorial, we will be discussing a program to find maximum points covered after removing an IntervalFor this we will be provided with N intervals and the maximum range value . Our task is to find that one interval which when removed will give us the maxim numbers in the given range from 1 to maximum range valueExample#include #define ll long long int using namespace std; //finding required interval void solve(int interval[][2], int N, int Q) {    int Mark[Q] = { 0 };    for (int i = 0; i < N; i++) {       ...

Read More

Maximum points of intersection n circles in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 213 Views

In this tutorial, we will be discussing a program to find maximum points of intersection n circlesFor this we will be provided with the number of circles. Our task is to find the maximum number of intersections the given number of circles meet.Example#include using namespace std; //returning maximum intersections int intersection(int n) {    return n * (n - 1); } int main() {    cout

Read More

Maximum points of intersection n lines in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 251 Views

In this tutorial, we will be discussing a program to find maximum points of intersection n linesFor this we will be provided with a number of straight lines. Our task is to find the maximum number of intersections the given number of lines meet.Example#include using namespace std; #define ll long int //finding maximum intersection points ll countMaxIntersect(ll n) {    return (n) * (n - 1) / 2; } int main() {    ll n = 8;    cout

Read More

Maximum possible difference of two subsets of an array in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 676 Views

In this tutorial, we will be discussing a program to find maximum possible difference of two subsets of an arrayFor this we will be provided with an array containing one or two instances of few random integers. Our task is to create two subsets of that array such that the difference of their sum is maximum and no subset contains repetitive numbers.Example#include using namespace std; //finding maximum subset difference int maxDiff(int arr[], int n) {    int SubsetSum_1 = 0, SubsetSum_2 = 0;    for (int i = 0; i

Read More
Showing 12691–12700 of 21,090 articles
Advertisements