Competitive Programming
The three major programming languages used in Competitive Programming are C++, Java, and Python. Each language has its own pros and cons. Some of them are mentioned below: C++: Pros- Takes very less execution time. Cons- It doesn't support some necessary functions. For example, it doesn't support decrease-key operation in the case of priority_queues. Java: Pros- Faster than python but slower than C++. Cons- Code becomes lengthy. Python: Pros- Code becomes very short, with various built-in functions available. Cons- Requires too much time for execution. The major competitive programming-based website is Codeforces in which generally around 15,000 participants participate in a contest. Every website has levels that can be in the form of stars, positions (like a specialist, expert, master, grandmaster, etc), or simply numerical rating.
Language Tools
The three major programming languages used in Competitive Programming are C++, Java, and Python. Each language has it's own pros and cons. Some of them are mentioned below: C++: Pros- Takes very less execution time. Cons- It doesn't support some necessary functions. For example, it doesn't support decrease-key operation in case of priority_queues. Java: Pros- Faster than python but slower than C++. Cons- Code becomes lengthy. Python: Pros- Code becomes very short, various built in functions available. Cons- Requires too much time for execution.
Setup for competitive programming
By Apoorv
● Published At Mar 2022
In this article, we will understand how to do the complete Setup for doing Competitive Programming in the c++ language in the local machine.... Keep reading ..
Boilerplate Competitive programming
By Saksham Gupta
● Published At Mar 2022
This blog will discuss the boilerplate used for competitive programming. ... Keep reading ..
Important tools to boost performance during contests
By Shreya Deep
● Published At Mar 2022
This article discusses the important tools to boost performance in contests.... Keep reading ..
Time & Space Complexity Analysis
Time and space complexities are very important features of any code. Since there can be one or more ways to solve a problem, using time and space complexities, we can figure out which way is the most efficient. Time complexity refers to the amount of time taken by the computer to run the program. While space complexity of a program is the amount of memory space required by the program while its execution. Both of these are a function of the input size passed.
Time Complexity
By Soumya Agrawal
● Published At Feb 2022
In this article, we will discover time complexity with the help of some examples. ... Keep reading ..
Space Complexity
By Soumya Agrawal
● Published At Feb 2022
This blog will cover the importance of space complexity and some examples.... Keep reading ..
Amortized Time Complexity in Data Structures
By Riya
● Published At Feb 2022
This article will discuss the concept of “Amortized time complexity in Data Structures”.... Keep reading ..
An interesting time complexity question in C++ | part 1
By Malay Gain
● Published At Feb 2022
In this article, we will learn to solve an interesting time complexity question in C++.... Keep reading ..
Check for Balanced Parentheses in an Expression
By Malay Gain
● Published At Dec 2021
In this article, we will learn how to check if a given expression has balanced parentheses or not. ... Keep reading ..
Practice Questions on Time Complexity Analysis in C++
By Malay Gain
● Published At Dec 2021
In this article, we will discuss the complexity analysis of some given questions. ... Keep reading ..
Time and Space Complexities of Sorting Algorithms Explained
By Abhishek Ranjan
● Published At Dec 2021
In this article, we are going to discuss the time and space complexity of the popular sorting algorithms: Selection Sort, Insertion Sort, Bubble Sort, Merge Sort, Quicksort, Heap Sort, Counting Sort, Radix Sort, and Bucket Sort. ... Keep reading ..
Recursion and Backtracking
If you’ve seen the movie inception, you’ll understand recursion easily. In the movie, Leonardo had a dream, in that dream he had another dream in that dream he had yet another dream, and that goes on. So it’s like there is a function called dream(), that’s being called over and over in itself. This is what recursion is. is useful in solving problems that can be broken down into smaller problems of the same type. Now, suppose you’re very hungry and wish to eat laddoos. There are three restaurants in front of you and someone already told you that only one restaurant sells laddoos. So what should you do? You first go to the first restaurant, check if laddoo is available there. If yes, eat it and you’re done. Otherwise, come out of the first restaurant, move on to the next restaurant, and check if it’s available there. If yes, eat it and you’re done. If not, you come out of the second restaurant also and move to the third one. That must be selling laddoos as one of the restaurants is surely selling laddoos. This is backtracking. So basically in backtracking we attempt solving a subproblem, and if we don't reach the desired solution, then undo whatever we did for solving that subproblem, and try solving another subproblem.
Recursion
When we repeat a similar process many times, it is known as Recursion. In Recursion, a function calls itself many times till it hits some base case, m
Divide and Conquer
The idea of Divide and Conquer is that if your enemy is more powerful than you, you should divide your enemy into parts that you can conquer easily. D
Backtracking
When they said ‘Two steps forward, one step back, they were talking about backtracking. In backtracking, we try out various outcomes possible for one
Sorting Based Problems
Sorting-based algorithms are the ones that help in rearranging the data according to a given criterion. The contacts in your phonebook are sorted lexicographically. The cash in your wallet might be sorted in ascending or descending order. The posts on your Instagram wall are actually sorted from latest to oldest. Let’s learn about some of the most popular sorting problems to make your life and programming easier.
Longest Common Prefix Using Sorting
By Harsh Goyal
● Published At Dec 2021
This article will discuss the longest common prefix problem using the sorting approach. ... Keep reading ..
Make it Sequential
By Abhishek Ranjan
● Published At Dec 2021
In this article, we will try to solve a question on sorting algorithms that can be asked in interviews. ... Keep reading ..
Create Arithmetic progressions in the array
By Anant Dhakad
● Published At Dec 2021
Arrays and Sorting are widely asked topics in coding interviews. This article will look at a problem involving arrays and arithmetic progressions.... Keep reading ..
Creative Sorting problem
By Anant Dhakad
● Published At Dec 2021
Arrays and Sorting are widely asked topics in coding interviews. This article will look at a problem involving arrays and mergesort.... Keep reading ..
Find the Minimum Length Unsorted Subarray, Sorting Which Makes the Complete Array Sorted
By Soumya Agrawal
● Published At Jan 2022
This article will cover the implementation of the problem Find the Minimum Length Unsorted Subarray, Sorting Which Makes the Complete Array Sorted to find the minimum length unsorted array, which makes the array wholly sorted.... Keep reading ..
Maximum Gap
By Arun Nawani
● Published At Nov 2021
Our task in this problem would be to find and return the maximum Difference between any two consecutive elements in a sorted array. ... Keep reading ..
Median Again
By Soumya Agrawal
● Published At Jan 2022
This blog will cover the approach and implementation of the famous sorting problem, i.e., the Median Again.... Keep reading ..
Find The Last
By Abhishek Ranjan
● Published At Dec 2021
In this article, we will try to solve a question on sorting algorithms that can be asked in interviews.... Keep reading ..
Maximum Score Difference
By Anant Dhakad
● Published At Dec 2021
Arrays and Sorting are widely asked topics in coding interviews. This article will look at a problem involving arrays, sorting, and binary search.... Keep reading ..
Find the sum of elements less than A and greater than B in an array
By Sandeep kamila
● Published At Jan 2022
This article discusses the different approaches to finding the sum of elements less than A and greater than B in an array with examples and its C++ code.... Keep reading ..
Program to find the number of misplaced elements from the index after sorting
By Sandeep kamila
● Published At Jan 2022
This article discusses the approach to finding the number of misplaced elements from the index after sorting with its C++ code.... Keep reading ..
Smallest subarray to sort in the given array
By Yukti Kumari
● Published At Dec 2021
This article explains the various approaches to the problem of finding the smallest subarray to sort in a given array. ... Keep reading ..
Maximum Divisors in a Range
By Vibhor Bhatnagar
● Published At Dec 2021
This article will discuss the problem of finding the maximum divisors in a range. ... Keep reading ..
Maximum Sum Path
By Vibhor Bhatnagar
● Published At Dec 2021
This article will discuss the problem of finding the maximum sum path from two arrays. ... Keep reading ..
Minimum Loss
By Vaibhav Agarwal
● Published At Dec 2021
In this article, we will discuss the problem of finding the minimum loss under the given conditions.... Keep reading ..
Find the Minimum Difference Between any Two Elements
By Malay Gain
● Published At Jan 2022
In this article, we will learn to find the minimum difference between any two elements from a given array. ... Keep reading ..
Sort the Given Array after Sorting Each Number Individually
By Malay Gain
● Published At Jan 2022
In this article, we will discuss how to sort the given Array after sorting each number individually. ... Keep reading ..
Find all indices of a given element in the sorted form of the given array
By Sandeep kamila
● Published At Dec 2021
This article covers finding all indices of a given element in the sorted form of the given array.... Keep reading ..
Sort given Array using at most N cyclic shift on any subarray
By Malay Gain
● Published At Jan 2022
In this article, we will learn how to sort a given Array using at most N cyclic shift on any subarray.... Keep reading ..
Kth lexicographically smallest distinct String from given Array of Strings
By Riya
● Published At Feb 2022
This article will discuss the problem “Kth lexicographically smallest distinct string from a given array of strings”, the solution approach to this problem, its C++ implementation, and its time and space complexity.... Keep reading ..
How to sort and separate even and odd numbers in an array using a custom comparator?
By Sandeep kamila
● Published At Dec 2021
This article covers how to sort and separate the even and odd numbers in an array using a custom comparator with complete explanation and C++ code.... Keep reading ..
Minimize the number of Knapsacks with total weight W required to store Array containing elements greater than W/3
By Apoorv
● Published At Feb 2022
This article will discuss the solution of the problem “Minimize the number of Knapsacks with total weigh W required to store Array containing elements greater than W/3” along with the time complexity and space complexity of the solution... Keep reading ..
Sort a Linked List after Converting Elements to Their Squares
By Aman Chourasiya
● Published At Dec 2021
In this blog, we will discuss a coding problem based on linked lists. The problem involves applications of reversing a linked list and merging two linked lists.... Keep reading ..
Sorting by combining Insertion Sort and Merge Sort algorithms
By Vibhor Bhatnagar
● Published At Jan 2022
In this article, we will discuss a sorting algorithm that is made by combining insertion sort and merge sort.... Keep reading ..
Sort all even numbers in the Array without changing the order of odd elements
By Sandeep kamila
● Published At Dec 2021
This article covers how to sort all even numbers in the array without changing the order of odd elements with examples and code in C++.... Keep reading ..
Maximum number of overlapping intervals
By aniket verma
● Published At Oct 2021
This article will brief you about finding the Maximum number of overlapping intervals.... Keep reading ..
Shortest Unsorted Continuous Subarray
By Ishita Chawla
● Published At Nov 2021
This blog will discuss three different approaches to find the length of the shortest unsorted continuous subarray. ... Keep reading ..
Non-Overlapping Intervals
By aniket verma
● Published At Nov 2021
This article will brief you on finding the number of overlapping intervals to be removed to maximize the Non-Overlapping Intervals.... Keep reading ..
Chocolate Distribution Problem
By Urwashi Priya
● Published At Nov 2021
This article will brief you on Chocolate Distribution Problem. ... Keep reading ..
Magnetic Force Between Two Balls
By Malay Gain
● Published At Nov 2021
In this article, we will learn how to solve the problem, magnetic-force-between-two-balls... Keep reading ..
Maximum Disjoint Intervals
By aniket verma
● Published At Oct 2021
This article will brief you on finding the Maximum Disjoint Intervals. ... Keep reading ..
Bit manipulation
The act of algorithmically manipulating bits or other chunks of data shorter than a word is known as bit manipulation. It is used for error detection, correction algorithms, and solving various other problems in Data Structure and Algorithms. It is sometimes necessary to consider data at the bit level. The most crucial point is that operations can be completed in constant time using bit manipulation. Since bit manipulations are executed in parallel, they can sometimes eliminate or reduce the requirement to loop over a data structure, resulting in many-fold speedups. For bit manipulation, programming languages such as C, C++, and Java support six bitwise operators.
Hamming Distance
By Rhythm Jain
● Published At Oct 2021
This article discusses the problem of Hamming Distance, where we have to calculate the hamming distance between two integers.... Keep reading ..
Total Hamming Distance
By Soumya Agrawal
● Published At Oct 2021
This article will brief you about the hamming distance between two integers is the number of positions where the corresponding bits will be different. ... Keep reading ..
Ugly Numbers 2
● Published At Oct 2021
This article discusses the problem of Ugly Numbers 2, where we have to find the nth ugly number.... Keep reading ..
Find Elements
By Husen Kagdi
● Published At Dec 2021
In this blog, we will discuss a famous interview coding question, “Find Elements” and its various solutions.... Keep reading ..
Bitwise AND of Numbers Range
By Ishita Chawla
● Published At Dec 2021
This blog will discuss the different ways to solve the problem of bitwise AND of Numbers Range, subsequently discussing the time and space complexity. ... Keep reading ..
Longest Consecutive Sequence of 1’s in the Binary Representation of a Number
By Akshat Chaturvedi
● Published At Oct 2021
In this blog post, we’ll study one easy problem from the topic of data structures: finding the longest consecutive sequence of 1’s in the binary representation of a number. ... Keep reading ..
Minimum X (xor) A
By Malay Gain
● Published At Oct 2021
In this article, we will learn about the problem Minimum X (xor) A and solve how to find the value of X for which X xor A is the minimum, and X should satisfy the given condition. ... Keep reading ..
Lucky Alive Person in a Circle
By Soumya Agrawal
● Published At Oct 2021
This blog will help you build logic for the problem Luckiest Person and other problems related to this.... Keep reading ..
Count Number of Set Bits in an Integer
By Ishita Chawla
● Published At Dec 2021
In this blog, we will be discussing four different approaches to count the total number of set bits in the binary representation of an integer. ... Keep reading ..
Gray Code
By Harsh Goyal
● Published At Oct 2021
This article will introduce Gray Code and give an introduction to Gray Code and will provide approaches to use it in different data structure problems.... Keep reading ..
Number of Steps to Reduce a Number in Binary Representation to One
By vaishnavi pandey
● Published At Oct 2021
In this, we will discuss the problem i.e number of steps to reduce a number to one and its approach to code. ... Keep reading ..
Divide Two Integers
By Ishita Chawla
● Published At Dec 2021
This blog will discuss the problem of divide two integers and solve it using different approaches focusing on the time and space of each approach.... Keep reading ..
Bitwise Operators in C++
By Rhythm Jain
● Published At Feb 2022
This article discusses the types of Bitwise Operators in C/C++ and their use.... Keep reading ..
Binary Numbers of N digits
By Rhythm Jain
● Published At Feb 2022
This article discusses the Problem of printing all Binary Numbers of N digits... Keep reading ..
Generate All Binary Numbers in the Range [L, R]
By Firdausia Fatima
● Published At Jan 2022
In this blog, we’ll use a simple loop and bit knowledge on the length of a decimal number to solve the problem, ‘Generate all binary numbers in the range [L, R]’.... Keep reading ..
Find a Number X Such that XOR of Given Array after Adding X to Each Element is 0
By Abhishek Ranjan
● Published At Jan 2022
In this article, we will solve a bit manipulation problem that will help you to get a good grasp on bits.... Keep reading ..
Convert given binary to its equivalent ASCII character string
By Shreya Deep
● Published At Dec 2021
In this article, we will learn how to convert a given binary string to its equivalent ASCII character string... Keep reading ..
Count Set Bits in Index Range [L, R] in Given Array for Q Queries
By Malay Gain
● Published At Mar 2022
In this article, we will learn how to count set bits in index range [L, R] in the given Array for Q queries. ... Keep reading ..
Count total set bits in an array
By Shreya Deep
● Published At Dec 2021
In this article, we will find out how to find the count of total set bits in an array... Keep reading ..
Form a Number Using Bit Rotations of N having the Same Frequency of each Digit
By Soumya Agrawal
● Published At Mar 2022
This article will cover the approach and implementation of the problem- Form a Number Using Bit Rotations of N having the Same Frequency of each Digit.... Keep reading ..
Maximize Bitwise AND of the array by replacing at most one element
By Vibhor Bhatnagar
● Published At Dec 2021
This article will discuss the problem to maximize bitwise AND of the array by replacing at most one element ... Keep reading ..
Bit Stuffing and Bit Destuffing
By Firdausia Fatima
● Published At Jan 2022
In this blog, we’ll address the problem of bit stuffing and bit de-stuffing by simple logic and understanding of loops.... Keep reading ..
Find the maximum product of Bitwise AND and Bitwise OR of K-size subarray
By Vibhor Bhatnagar
● Published At Jan 2022
This article will discuss the problem to find the maximum product of Bitwise AND and Bitwise OR of K-size subarray ... Keep reading ..
Find the size of the largest subset with bitwise AND greater than their bitwise XOR
By HET FADIA
● Published At Jan 2022
The blog aims to find the size of the largest subset whose bitwise AND is greater than its bitwise XOR and explains the process of how to reach the solution.... Keep reading ..
Find the total number of subsequences having odd Bitwise AND values in the array
By Gaurish Anand
● Published At Feb 2022
This article explains how to determine the total number of subsequences having odd bitwise and values in the array.... Keep reading ..
Find the total number of subsequences having odd Bitwise OR values in the array
By Gaurish Anand
● Published At Feb 2022
This article explains how to determine the total number of subsequences having odd bitwise OR values in the array.... Keep reading ..
Maximize sum of LSBs of Bitwise OR of all possible N/2 pairs from given Array
By HET FADIA
● Published At Jan 2022
The blog aims to find the maximum sum of LSBs of Bitwise OR of all possible N/2 pairs from the given Array.... Keep reading ..
Find the next greater number formed with exactly two unique digits for each array element
By Shreya Deep
● Published At Jan 2022
This article describes how to find the next greater number formed with exactly two unique digits for each array element... Keep reading ..
String
A string is a data type in programming languages. It consists of a sequence of characters. Strings are usually declared inside double quotes like- "hello." Each character in a string has a specific index, where the indexing starts from 0.
Basic String Problems
Due to the various string manipulation methods available in modern programming languages, we can find the length of a string, search for a specific ch
Pattern Matching
Pattern Matching algorithms are one of the most important algorithms. They are used whenever we want to search a string or a substring in another stri
Advanced String Algorithms
Advanced string algorithms often use Dynamic programming to perform some operations on a string or multiple strings. Examples of such algorithms are R
Number Theory
Number Theory is concerned mainly with the study of properties of positive integers. Problems in competitive programming involving Maths are usually based on number theory. If we know number theory, it increases our ability to solve more challenging problems, clears our concepts, and helps us get a solid hold on programming.
Basics
Number theory involves various types of integers like prime numbers, composite numbers, and the relation between them. Base numbers and arithmetics nu
Advanced
The advanced topics that come under Number Theory are Modular Exponentiation, Fermat's Little Theorem, Wilson's Theorem, Chinese Remainder Theorem, Eu
Greedy
Greedy is one kind of algorithmic paradigm that follows the approach of making the locally optimal choice at each stage that leads to the globally optimum solution. A greedy algorithm always takes the best immediate or local solution while finding the final solution. Any problem having optimal substructure and greedy property can be solved using a greedy algorithm.
Basic Greedy Problems
To solve any basic greedy problem, identify an optimal subproblem or substructure in the problem and solve the subproblems in an optimal way. Create s
Optimization Problems
The optimization problem is the problem of finding the best solution from all feasible solutions. To solve these problems constraints must be known. T
Dynamic Programming
Dynamic Programming is a technique of doing an optimization over recursion. We store the answer for the overlapping subproblems and use that result if we need the answer for the same problem in the future. Hence, we save the time of re-computing the answer for the same problem. It is a great technique that helps us to reduce the exponential time complexity to polynomial time complexity.
Basics
Dynamic Programming is a technique to solve a complex problem by breaking it in terms of smaller sub-problems followed by solving each subproblem only
Advanced
One of the most frightening topics in DSA is dynamic programming. To tackle a dynamic problem, first, create the recursive approach, then look for rep
Mixed Problems
Dynamic Programming or DP is a fundamental algorithmic paradigm that breaks the problem at hand into smaller subproblems and stores the solutions of s
Range Query
In Range Query problems, we commonly are given an array of N integers and Q queries of one or more types. The range [L, R] of the query will also be given, and based on it, we will have to perform some function on the given array. Prefix Arrays, Segment Trees, Fenwick Trees, Mo's Algorithm are the various efficient methods to solve Range Query problems.
Segment Tree
The time complexity of range queries over an array, such as sum query over an interval or max number in an interval, is O(n). A segment tree is a data
Fenwick Tree
Fenwick Tree, also known as Binary Indexed Tree (BIT), provides an efficient way to compute prefix sum on an array allowing array modification. Consid
Sparse Table
SQRT Decomposition
scroll-indicator
scroll-indicator
AVL Tree
The AVL Tree is a height-balanced binary search tree in which each node has a balance factor that is computed by subtracting the height of the right sub-tree from the height of the left sub-tree. If the balance factor of each node is between -1 and 1, the tree is said to be balanced; otherwise, the tree is imbalanced and must be balanced.
Convert Sorted Array to Balanced BST
By Deeksha Sharma
● Published At Jan 2022
In this blog, we will learn how to build a binary search tree from a sorted array. Since the sorted array contains elements in sorted order, it becomes pretty easy to construct Balanced BST from it. ... Keep reading ..
Different Shapes of AVL Possible at Height H
By Sujal Modanwal
● Published At Jan 2022
The task is to find the number of possible shapes of minimal AVL Trees of a given height 'H'. ... Keep reading ..
Count Inversions in an Array Using AVL Tree
By GAZAL ARORA
● Published At Mar 2022
Inversion count for an array indicates how far (or close) it is from being sorted. In this article, we will design an algorithm for counting inversions in a given array using AVL Tree.... Keep reading ..
Find the Minimum number of nodes in an AVL Tree
By Aditya Narayan Joardar
● Published At Dec 2021
This article discusses how to find the minimum number of nodes in an AVL Tree with a given height.... Keep reading ..
Count of Array elements greater than all elements on its left and at least K elements on its right
By Ayush Tiwari
● Published At Jan 2022
This blog finds the number of array elements greater than all elements on its left and at least K elements on its right... Keep reading ..
Number of nodes greater than K in an AVL Tree
By Gaurish Anand
● Published At Feb 2022
In this article, we will learn to find the number of nodes greater than K in an AVL Tree (self-balanced BST).... Keep reading ..
Sort the big sized array where there are many repetitions of elements
By Vaibhav Agarwal
● Published At Jan 2022
This article will discuss the problem of sorting the big array with many repetitions of elements... Keep reading ..
Counting smaller elements on the right side
By Vibhor Bhatnagar
● Published At Jan 2022
In this article, we will discuss the problem of counting smaller elements on the right side. ... Keep reading ..
Find the closest greater value for every element in the array
By Ayush Tiwari
● Published At Dec 2021
This blog discussed finding the closest greater value for every element in the array. Read the blog to learn these methods in detail... Keep reading ..
Red-Black Tree
A red-black tree is a self-balancing binary search tree with one extra bit at each node, which is commonly read as the color (red or black). These colors are used to keep the tree balanced as insertions and deletions are made. The tree's balance isn't ideal, but it's good enough to cut down on searching time and keep it around O(log n), where n is the total number of components in the tree.
Introduction To Red-Black Trees
By Shubham Agarwal
● Published At Oct 2021
In this Blog, We will read about the Red-Black Tree, and we will compare it with the AVL tree, and we will Study how various operations work in the Red-Black tree-like searching. Then We will discuss the application of the Red-Black Tree. ... Keep reading ..
Insertion In Red-Black Trees
By Malay Gain
● Published At Oct 2021
In this article, we will learn how to insert a new node in a Red-Black Tree.... Keep reading ..
Red Black Tree Insertion
By Apoorv
● Published At Feb 2022
This article will discuss the algorithm for red black tree insertion along with the discussion on its space and time complexity. ... Keep reading ..
Red-Black Trees Top-Down Insertion
By Apoorv
● Published At Feb 2022
This article will discuss the algorithm for Red-Black Trees Top-Down Insertion along with the discussion on its space and time complexity.... Keep reading ..
Deletion in Red-Black Trees
By Malay Gain
● Published At Nov 2021
In this article, we will learn how to delete a node in a Red-Black Tree. We will discuss the algorithm for deletion in Red-Black Tree. ... Keep reading ..
Red-Black Tree (Delete)
By Jaglike Makkar
● Published At Feb 2022
In this article, we will discuss the approach to deleting a node in the Red-Black Tree.... Keep reading ..
Insertion in Left-Leaning Red-Black Tree
By GAZAL ARORA
● Published At Mar 2022
In this article, we will design an algorithm to insert in a left-leaning Red-Black Tree(LLRB). An LLRB performs the search, delete, and insert operations in O(logn) time.... Keep reading ..
Check if a given Binary Search Tree is height-balanced like a Red-Black Tree
By Shreya Deep
● Published At Jan 2022
This article discusses how to check if a given BST is height-balanced like a red-black tree.... Keep reading ..
Find the largest K for every Array element such that at least K prefixes are ≥ K.
By Jaglike Makkar
● Published At Feb 2022
In this article, we will discuss the approach to finding K for every index such that there are at least K prefixes greater than or equal to K. We will also focus on our approach’s time and space complexity.... Keep reading ..
Set
Sets are a type of data structure that can store all the unique values in it. There are ordered and unordered sets. When we add an element into the set, it only adds the new element if it is not already present in the set. Every element of the set, once added, is immutable. However, we can add and remove elements from the set.
Implementing Sets Without C++ STL Containers
By Anant Dhakad
● Published At Dec 2021
In this blog, we will learn about the implementation of Set without using C++ STL containers.... Keep reading ..
Fair Candy Swap
By Soumya Agrawal
● Published At Nov 2021
In this blog, we will discuss the problem of swapping candies and see the various implementations of this problem.... Keep reading ..
Count the total numbers with no repeated digits in a range
By Gaurish Anand
● Published At Dec 2021
This article explains the problem of counting the total numbers with no repeated digits in a given range for Q queries.... Keep reading ..
Count of Isogram Strings in a Given Array of Strings with Length at Least K
By Soumya Agrawal
● Published At Jan 2022
This article will cover the approach and the implementation of the problem where we have to find the count of isogram strings in a given array with a length of at least K.... Keep reading ..
Maximize count of distinct elements in a subsequence of size K in given array
By Aman kumar Chourasiya
● Published At Jan 2022
In this blog, we will take up a coding challenge based on constructive algorithms and tricky observation. We will discuss various approaches to solve the problem.... Keep reading ..
Find numbers in the range [L, R] that are coprime with all given Array elements
By Sandeep kamila
● Published At Jan 2022
This article discusses the approach to finding the numbers in the range [L, R] that are coprime with all given array elements and implementation in C++. ... Keep reading ..
Count Of Pairs In Given Array Whose GCD Is Not Prime
By Harsh Goyal
● Published At Jan 2022
This article will discuss to count the pairs in the given Array whose GCD is not prime and the approach to solve this problem.... Keep reading ..
Graph
A graph is a type of non-linear data structure. A graph is defined as a group of vertices, and edges are used to connect these vertices. There are many different types of graphs, such as directed, undirected, weighted, unweighted, cyclic, acyclic, etc. There are many real-life applications of the graph. They are used in maps, social media, path optimization algorithms, etc.
Basic
A graph is an ADT, here ADT refers to the Abstract Data Type, and it can be used to represent non-linear relationships and complex relationships betwe
Advanced
The advanced topics under Graph Data Structure include traversable and Euclidean graphs, isomorphic and homogeneous graphs, fuzzy graphs, etc. Questio
Mixed Problems
Advanced graph concepts can seem tricky at first. But after getting a good understanding, they can get easier. Let us try to solve some mixed problems
Miscellaneous
Explore detailed explanations as well as the implementation of various topics in Competitive Programming. These topics are important in interview preparations. Try to implement them yourself before moving on to the solutions.
Trie
Trie has the following properties for a set of strings: 1. The root node always represents the null node. 2. Every node's child is arranged alphabet
Computational Geometry
Computational geometry is a branch of computer science devoted to the study of algorithms that can be stated in terms of geometry. Some purely geometr
Disjoint Set
In computer science, a disjoint-set data structure is also called a union-find data structure or merge–find set. It is a data structure that stores a
Game Theory
Game Theory is a topic in competitive programming that usually comes in contests with a mixture of other topics like greedy, dynamic programming, etc.
Miscellaneous Problems
In competitive programming contests, various miscellaneous problems involving the concept of Trie, Computational Geometry, Game Theory, etc., are aske
scroll-indicator
scroll-indicator
String Matching
Maximum Number Of Occurrences Of A String By Replacing All The Question Marks
By Jaglike Makkar
● Published At Mar 2022
In this article, we will discuss how to find the maximum number of occurrences of a string in the other string by replacing all the question marks in the other string. We will also focus on the complexity of our solution.... Keep reading ..
The number of times array B appears as a subarray in A
By Jaglike Makkar
● Published At Mar 2022
Given two arrays A and B, we have to find the number of times array B appears as a subarray in A if we can add some arbitrary constant value to every element in the second array.... Keep reading ..
Inappropriate Words Filter
By Teesha Goyal
● Published At Mar 2022
This article discusses the problem of filtering inappropriate words... Keep reading ..
Decode Morse Code
By Teesha Goyal
● Published At Mar 2022
This article discusses the problem of decoding the morse code... Keep reading ..
Prefix-Suffix Palindrome
By Manan Singhal
● Published At May 2022
In this article, we will solve one of the popular problems, Prefix-Suffix Palindrome using Manacher's Algorithm.... Keep reading ..
Password Substring
By Teesha Goyal
● Published At Mar 2022
This article discusses the problem of Substring Password... Keep reading ..
Count all substrings of all lengths that match exactly with the prefix and suffix of a string
By SHIKHAR SONI
● Published At Feb 2022
The article discusses the brute force and optimal approach for calculating the count of all substrings that match exactly with the prefix and suffix of a string.... Keep reading ..
x-Prime Substring
By Yukti Kumari
● Published At Jan 2022
This article explains the methods for solving the problem of the x-prime substring.... Keep reading ..
puzzle icon

Top Problems related to Competitive Programming