Given two positive integers X and Y, the task is to count pairs with even sum possible by choosing any integer from the range 1… Read More

# Category Archives: Competitive Programming

Reasons behind getting TLE: It is slower compared to other programming languages. It offers slower Input/Output. It has a lower recursion depth which often gives… Read More

Given a 2D array arr[][] with each row of the form {l, r}, the task is to find a pair (i, j) such that the… Read More

Given a string str, the task is to count non-empty substrings with equal number of ‘a’, ‘b’, ‘c’, and ‘d’. Examples: Input: str = “abcdef” Output:… Read More

While solving problems on any online judge sometimes it might get Time Limit Exceeded. Below are some of the ways to optimize the code: Minimize… Read More

In Competitive programming, most of the students use C++ as their primary language as it is faster than the other languages(e.g Java, Python) but for… Read More

Choosing the appropriate language while starting competitive programming is the most important factor. Generally, we choose that language that has short syntax and executes very… Read More

Given a matrix of dimensions N * M and a 2D array Queries[][] with each query of the form {k, r1, c1, r2, c2}, the… Read More

Given a binary string S of length N, the task is to find the longest substring consisting of ‘1’s only present in the string after… Read More

Given an array, arr[] of size N (always even), the task is to construct a new array consisting of N non-zero integers such that the… Read More

In Competitive Programming, it is important to read input as fast as possible to save valuable time. Input/Output in Python can be sometimes time taking… Read More

Competitive Programming has been the most trending activity to be part of for the whole coders’ community on today’s date. Competitive programming is a brain… Read More

Given an array, arr[] of size N and an integer K, the task is to find the minimum number of operations required to make all… Read More

Given five integers X, Y, A, B, and N, the task is to find the maximum possible absolute difference between X and Y by performing… Read More

Given an array of strings arr[], the task is to find the pair of strings from the given array whose length of the longest common… Read More