Wednesday, 1 Dec 2021
Category: Competitive Programming

With robotics technology moving rapidly ahead of itself, it has become very important for developers to meet software needs. The hardware mechanics have become very advanced over time and are being upgraded at a regular interval. But these hardware systems cannot run on themselves. They require software to control them and process the operation they […]

#include using namespace std;  void merge(vector& v, int left,           int mid, int right, int& inversions){    vector temp(right – left + 1);      int i = left;    int j = mid + 1;    int k = 0;    int cnt = 0;      while (i

When we talk about Competitive Programming, we can’t ignore the significance of Mathematics here. Yes, it is true that one can get started with competitive programming without any mathematical background, but it is also an unbeatable fact that having good command over several specific mathematical concepts gives you the much-needed advantage over others while solving […]

Given an array arr[], the goal is to count the number of inversions in all the sub-arrays. An inversion is a pair of indices i and j such that i > j and arr[i] < arr[j]. A sub-array from index x to y ( x= j.Naive Approach: A naive approach is to generate all possible […]

Maximum sum obtained by dividing Array into several subarrays as per given conditionsGiven an array arr[] of size N, the task is to calculate the maximum sum that can be obtained by dividing the array into several subarrays(possibly one), where each subarray starting at index i and ending at index j (j>=i) contributes arr[j]-arr[i] to […]

Print greater elements present on the left side of each array elementGiven an array arr[] consisting of N distinct integers, the task is to print for each array element, all the greater elements present on its left.Examples:Input: arr[] = {5, 3, 9, 0, 16, 12}Output:5: 3: 59: 0: 9 5 316: 12: 16Input: arr[] = {1, 2, 0}Output:1: 2: 0: […]

Given an array arr[] consisting of N distinct positive integers and an integer K, the task is to find the minimum MEX from all subarrays of length K. The MEX is the smallest positive integer that is not present in the array. Examples: Input: arr[] = {1, 2, 3}, K = 2Output: 1Explanation:All subarrays of […]

Competitive Programming is a mental sport which enables you to code a given problem under provided constraints. The purpose of this article is to guide every individual possessing a desire to excel in this sport. This article provides a detailed syllabus for Competitive Programming designed by industry experts to boost the preparation of the readers. […]