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… Read More

# Category Archives: Competitive Programming

Competitive Programming is vital for one’s development in the coding field. This article is going to discuss some basics points one should keep in mind… Read More

Given an array arr[] consisting of N positive integers, the task is to rotate the digits of array elements in an anti-clockwise direction such that… Read More

Given an array arr[], the task is to find the count of array elements whose squares are already present in the array. Examples: Input: arr[]… Read More

Given a matrix of size M x N consisting of integers, the task is to print the matrix elements using Breadth-First Search traversal. Examples: Input:… Read More

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

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