Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last updated: Oct 29, 2021

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.
Application To Master Competitive Exams
Author
0 upvotes
Outdated programming language not to learn in 2024
Author
0 upvotes
Pros and Cons Of Open Source Programming Languages MEDIUM
Author Madha1
0 upvotes
5 Reasons to start Coding Early
Author
0 upvotes
5 blogs Every Software Developer Must Read
Author
0 upvotes
5 Tech-Giants Hiring Coders
Author
0 upvotes
Major programming Trends to Watch Out For in 2024 MEDIUM
Author
0 upvotes
7 Things to Equip Before Coding Competition MEDIUM
Author
0 upvotes
Competitive Programming And The Edge It Offers MEDIUM
Sites and Tools for Competitive Programming MEDIUM
How To Get Started With Competitive Programming?
This article will discuss the complete roadmap of competitive programming for beginners in detail.

Asymptotic Analysis

When you enter the field of competitive programming, it's not just okay to go with the solution but to find the best possible solution for a problem. This section in fact this whole category will teach you how to approach a problem and how to find the best possible solution in a limited amount of time and space. This section particularly helps you understand the various cases that a program has in time and space.
Time Complexity
In this article, we will discover time complexity with the help of some examples.
Space Complexity with Examples
Read space complexity: the algorithm's space usage, including auxiliary and input space. Explore space complexity examples with code, output, and explanations.
Amortized Time Complexity in Data Structures
This article will discuss the concept of “Amortized time complexity in Data Structures”.
Author Riya
1 upvote
Interesting Questions from (Substitution, Iteration, Recursion Tree, Master)
We will solve some interesting questions and algorithms in this blog using the master theorem and the substitution method.
Time & Space Complexity of Sorting Algorithms - 2 (N*logN)
In this article, we will learn about different sorting algorithms' time and space complexity. We will also discuss the best case and worst case for the algorithms.
Question Bank for Time & Space Complexity
This blog will discuss different questions related to time and space complexities.
Prime Factorisation Method Using Sieve O(log n) For Multiple Queries
This article discusses the prime factorization method using sieve of Eratosthenes, and then application of prime factorization.

Beginners Level

Welcome to the beginner-level ninja training for competitive programming, this section covers the topics that'll you expect a beginner to solve in the field of competitive programming, this is an interesting journey for a rookie competitive programmer, as you'll be challenged by the problems here, so just try to solve them on your own and if you get stuck, just remember we're always there to help.
Setup for competitive programming
In this article, we will understand how to do the complete Setup for doing Competitive Programming in the c++ language in the local machine.
Author Apoorv
3 upvotes
Boilerplate Competitive programming
This blog will discuss the boilerplate used for competitive programming.
Important tools to boost performance during contests
This article discusses the important tools to boost performance in contests.
Next Permutation
In this blog, we'll be discussing different approaches for solving one of the classic interview problems, i.e., Next Permutation.
Single Number
In this blog, we’ll learn to find a single number from an array of elements where every element appears twice except one.
Suffix Array Optimal Construction HARD
In this article, we will discuss two approaches to construct a suffix array in java.
Intersection of Two Arrays
This blog will discuss how we can solve the problem ‘Intersection of two arrays’.
Sliding Window
In this blog, we will be discussing the famous sliding window technique, how it is more efficient than the naive approach, and its time and space complexity.
Divide the Chocolate
In this blog, we will cover the Divide the Chocolate question and discuss Time and Space complexity.
Car Pooling MEDIUM
In this blog, we will discuss Leetcode problem - Carpooling with brute-force in an optimized manner along with the space and time complexity.
Author Yogi21
0 upvotes
Sort an Array of 0s,1s and 2s
This article discusses the different approaches to sort the array containing 0s,1s, and 2s, starting with the approach which is similar to the approach in the Dutch national flag problem and then an intuitive approach that simply maintains the count and finally stores it in the correct place.
Minimum coverage by heaters
This blog finds the minimum heaters range so it can warm all the houses.
Longest Common Prefix from Suffix Array MEDIUM
In this article, we will be discussing the two approaches to finding the longest common prefix of two substrings of a given string from the suffix array.
Next Greater and Smaller Element for Every Element in an Array MEDIUM
The program to find the next greater and smaller element for every element in an array is common in coding interviews. Its solution is discussed in this article.
How To Find The Kth Smallest Element In An Array? MEDIUM
Learn how to find the kth smallest element in an array using min heaps or sets. These algorithms are efficient and can be used on arrays of any size. Keep reading!
K’th Largest Element in an Array MEDIUM
Find the kth largest element in an array using various approaches, such as sorting, heap, and quick select. Learn how to implement these algorithms in C++, Java, and Python. Read on!
Find Smallest Missing Positive Integer MEDIUM
In this blog, we will be discussing four different approaches to finding the smallest missing positive integer in an unsorted array.
Find all triplets with zero-sum
This blog discusses the approach to find all triplets in an array of both positive and negative with zero-sum
Find all elements in an array which have at-least two greater elements. EASY
In this article, we will discuss how to find all elements in an array that have at-least two greater elements and understand the concept with examples in detail.
Find Index of 0 to be replaced with 1 to get the Longest Continuous Sequence of 1s in a Binary Array MEDIUM
This article discusses a DSA problem of specifically finding the index of 0 in a binary array that should be replaced with 1 to get the most extended sequence of continuous ones.
Two Best Non-Overlapping Events
In this blog, we will discuss a problem involving binary search and a tricky construction. We will learn a tricky construction that proves to be very useful to solve problems based on intervals.
Binary Subarrays with Sum MEDIUM
This article discusses the Binary Subarrays with Sum along with different approaches followed by the Implementation in C++, Python, and Java.
Hotel Bookings Possible
In this blog, we are going to discuss the problem of Hotel Bookings Possible. This is the most frequently asked problem in almost all tech interviews.
Find the sum of elements less than A and greater than B in an array
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.
Author Spider
0 upvotes
Print Next Greater Number of Q Queries MEDIUM
In this blog, we will learn the logic of how to print the next greater number of q queries and see how to implement the logic in c++.
Check if reversing a sub-array make the array sorted MEDIUM
In the blog, we will discuss the problem of checking if there exists a subarray that, when reversed, makes the whole array sorted.
Smallest Difference Triplet from Three arrays MEDIUM
This blog will give you detailed explanation and implementation of the approach to find the Smallest Difference Triplet from Three arrays
Suffix Array Construction (Brute Force N ^ 2 LogN)
This article explains the concept of suffix arrays and explains the naive algorithm for suffix array construction.
Rearrange Positive and Negative Numbers With Constant Extra Space | Part 1
This blog mainly focuses on the problem, namely, Rearrange Positive and Negative Numbers With Constant Extra Space. We will discuss different approaches to solve this problem with a proper explanation and flow diagram.
Minimum Number of Subsets with Distinct Elements EASY
In this article, we will look into an important coding question, Minimum number of subsets with distinct elements.
Find the first, second, and third minimum elements in an array EASY
In this blog, you will learn about the problem of finding the first three minimum elements in an array. We will go over various approaches to solve this problem.
Find an array element such that all elements are divisible by it EASY
In this blog, you will learn about the problem of finding an array element such that all elements are divisible by it. We will go over various approaches to solve this problem.
Count of Subarrays in the Range [L, R] having XOR + 1 equal to XOR (XOR) 1 for M Queries MEDIUM
In this blog, we’ll solve a fascinating problem Count of subarrays in the range [L, R] having XOR + 1 equal to XOR (XOR) 1 for M queries using parity.
Count Different Substrings in a String
This article will cover the implementation and approach of computing the different substrings in a string.
Count Divisible Pairs in an Array
In this blog, we will discuss count divisible pairs in an array problem. We will also discuss the algorithm and the implementation for the problem using hashmap in different languages.
Product of maximum in first array and minimum in second EASY
In this blog, we will discuss different approaches to multiple the maximum element of the first array to the minimum element of the second array. Then we will discuss their algorithms, pseudo-codes, and complexities analysis.
Find the sum of all the distinct elements in an array EASY
In this article, we will discuss the problem of finding the sum of all distinct elements in an array.
Find maximum average subarray of length k EASY
In this blog, we will discuss the approach to find the maximum average subarray of an array of length ‘k’.
Tandem EASY
In this article, we will solve one of the popular problems, Tandem.
Substrings and Frequency
In this blog, we will learn to solve a problem based on the suffix array.
Find Element at Given Index After Several Rotations
We will write a program to find the element at the given index after several Rotations.
Count triplets with sum smaller than a given value
In this article, we will discuss the counting of triplets with a sum less than the given value. We will also look at the problem statement in detail, followed by its various approaches, code, and complexities.
The Suffix Matches
In this article, we will learn how to find the longest matching suffix.
Ada String
This article describes how to find the number of distinct substrings beginning with each letter.
Double the first element and move zero to the end
In this blog, we will discuss the approach to double the first element and move zeros to the end.
Design Parking System EASY
This article thoroughly discusses the Design Parking System using various examples, explanations, and codes.
Replace two consecutive equal values with one greater value EASY
In this blog, we will discuss the approach to replace two consecutive equal values with one greater value in an array.
Check If a Number is Not a Power of 2 EASY
This blog will discuss different ways to check whether a number is not a power of 2.
Rat in a Maze HARD
This article we will discuss the classic backtracking problem called Rat in a Maze. We will look at the problem statement in detail followed by the algorithm and implementation in C++.
Word Search HARD
In this blog, we’ll discuss a really important problem: Word Search. We are also going to discuss the time and space complexities of the approaches covered.
Valid Sudoku HARD
This is part two of the Sudoku Solver article. In this article, we will discuss whether the given sudoku is valid or not.
Power Set EASY
In this blog, we will discuss one of the most asked questions in coding interviews, i.e., power set. We will look at all possible approaches to the given problem.
Sort a Given Array by Swapping Only Pairs with GCD as 1 MEDIUM
This blog check whether sorting a given array by swapping only pairs with GCD as 1 is possible or not. Read the blog to learn the method in detail.
Count of all unique paths from given source to destination in a Matrix EASY
This article will discuss to return the count of all unique paths from a given source to a destination in a Matrix and the approach to solve this problem.
C++ Program To Print All Permutations Of A Given String EASY
This article will discuss printing all the permutations of a given string and the approach to solve this problem in C++ language.
Maximize Cost of Forming a Set of Words Using Given Set of Characters EASY
In this blog, we will see how we can solve the famous problem ‘Maximize Cost of Forming a Set of Words Using a Given Set of Characters’.
Print all unique paths from a given source to destination in a Matrix moving only down or right MEDIUM
This article will brief you on the problem to Print all unique paths from a given source to destination in a Matrix moving only down or right.
Print All Paths from a Source Point to All the 4 Corners of a Matrix HARD
In this article, we will solve a problem using recursion and backtracking that can be asked in the interviews.
Print all Paths to Escape Out of a Matrix using K Moves HARD
In this blog, we’ll be solving a backtracking question on matrix, ‘Print all paths to escape out of a matrix using K moves.’
Sum of all the subsets whose sum is a Perfect Number from a given array MEDIUM
This article discusses how to calculate the sum of all the subsets whose sum is a Perfect Number from a given array with a complete explanation and its C++ code.
Author Spider
0 upvotes
Minimize operations to transform A to B by multiplying by 2 or appending 1 to it MEDIUM
This article will brief you to Minimize operations to transform A to B by multiplying by 2 or appending 1 to it.
Implement Hamiltonian Cycle HARD
In this article, we will discuss the problem of printing the hamiltonian cycle for the given graph
The K-th Lexicographical String of All Happy Strings of Length ‘N’ HARD
In this blog, we will discuss the problem to find the K-th lexicographical string of all happy strings of length ‘N.’
Determine the longest path from the source cell to the destination cell in a matrix
In this article, we will learn how to determine the longest path from the source cell to the destination cell in a 2D matrix.
M Coloring Problem MEDIUM
In this article, we'll discuss one of the basic problems of graph theory i.e. m-coloring problem along with its implementation in different languages.
Print all the Balanced Brackets Strings that can be formed by replacing '?' in string
This article will discuss the solution to Print all the Balanced Brackets Strings that can be formed by replacing '?' in a string. Along with the solution, the article focuses on the time and space complexity of the solution.
Maximum length of a string having even frequency of each character formed by concatenation
This article will discuss the problem "Maximum length of a string having even frequency of each character formed by concatenation," the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
1 upvote
Arrange Elements of Given Array in a Mathematical Expression using Operators [+, -, *, /] and Parentheses to Get Value 28
Elements of a given array are to be arranged in an array using operators [+, -, *, /] and parenthesis to obtain the value of 28.
Solve Sudoku on the Basis of the Given Irregular Regions
In this article, we will learn how to solve the sudoku puzzle on the basis of the given irregular regions.
Permutations of a Given Number That are Powers of 2
This article will cover the problem of finding the permutations of a given number in which digits are the perfect power of 2.
Least count of words required to construct a target String
This article will brief you on finding the least count of words required to construct a target String.
Path exists in the matrix with the addition of element is at most K.
This article will brief you to Check if a path exists in the matrix with the addition of element is at most K.
Generate all possible combinations of K numbers that sum to N MEDIUM
This blog finds all possible combinations of K numbers that sum to N. Read the blog to learn the problem's implementation in detail.
Fast Fourier Transform for polynomial multiplication
This article explains the idea of fast fourier transform for polynomial multiplication.
Fibonacci numbers
This blog covers the concepts of fibonacci numbers, the matrix multiplication in fibonacci numbers and the golden ratio approach to find the Nth fibonacci number.
Finding Repetitions MEDIUM
This article incorporates information about the problem finding repetitions and how to implement this problem by the Main-Lorentz algorithm.
Tiling Problem Using Divide and Conquer Algorithm MEDIUM
In this article, we will discuss the popular tiling problem and an approach to how to solve it using a divide and conquer algorithm with the implementation in C++, Java, and Python.
Check if a number is a palindrome or not without using any extra space EASY
This article tells us how to check whether a number is a palindrome in O(1) space complexity.
Check if the array can be split into subarrays such that the XOR of the length of the Longest Decreasing Subsequences of those subarrays is 0
In this article, we will discuss the problem to check if the array can be split into subarrays such that the XOR of the length of the Longest Decreasing Subsequences of those subarrays is 0
Count Pairs (i, j) From a Given Array Such that ARR[i] > K * ARR[j] EASY
This blog will discuss how we can solve one of the most asked problems based on merge sort, i.e., count pairs (i, j) from a given array such that ARR[i] > K * ARR[j].
Count the number of inversions in an array using merge sort
This article discusses the approach to count the number of inversions in an array using merge sort with its C++ code.
Reduce array to longest sorted array possible by removing either half of given array in each operation
This article will discuss to reduce the array to the longest sorted array possible by removing either half of the given array in each operation and the way to solve this problem.
Scramble string MEDIUM
In this article, we’ll learn how to solve the scramble string problem.
Koko Eating Bananas MEDIUM
In this blog, we will solve one of the problems of the Leetcode in a naive approach to optimized one.
Author Yogi21
2 upvotes
Count Negative Numbers in a Sorted Matrix EASY
This blog discusses how to count the number of negative numbers in the sorted grid.
Merge two sorted arrays in O(1) extra space using QuickSort partition
This article will brief you on how to Merge two sorted arrays in O(1) extra space using QuickSort partition.
Longest Substring with At Least K Repeating Characters
This article will brief you on finding the Longest Substring with At Least K Repeating Characters.
How to find the minimum capacity of the ship to ship packages within d days.
This blog focuses on the solution to the problem of finding the minimum capacity of the ship to ship packages in d days. Read further to learn the detailed solution.
Median of Two Sorted Arrays
The blog discusses in detail the median of two sorted arrays. We’ll discuss many approaches to solve the problem along with time and space complexity for each method.
Author Zenith
0 upvotes
Longest Common Prefix using Divide and Conquer Algorithm
In this article, we will learn how to find Longest Common Prefix using the Divide and Conquer Algorithm.
Check if a Substring Exists, having Only Two Distinct Characters with The Frequency of One as Twice The Others EASY
Arrays and String are widely asked topics in coding interviews. This article will look at a problem involving arrays and strings.
Manacher’s Algorithm EASY
In this article, we will study how to find all the substrings that are palindromes using Manacher’s Algorithm. We will also discuss the space and the time complexity of our solution.
Count of Increasing Substrings in given String MEDIUM
This blog will cover the problem of counting the number of increasing substrings in a string.
Print all subsequences of a string
In this article, we will discuss how to print all subsequences of a string.
Maximize the Confusion of an Exam
In this blog, we will discuss an exciting problem, namely “Maximize the confusion of an Exam”. It is an ad-hoc problem.
Minimizing the count of a subsequence of a given binary string such that any subsequence doesn’t contain adjacent zeroes or ones
This article will discuss the problem of finding the minimum number of subsequences of a given binary string such that any subsequence doesn’t contain adjacent zeroes or ones.
Count of All Substrings in a Binary String in Which Count of 1’s is Strictly More than the Count of 0’s HARD
This blog will discuss the problem of counting the substrings in a binary string that contains more 1s than 0s.
Find the longest substring in a binary string with an equal count of 0s and 1s
In this article, we will learn to find the longest substring in a string containing only 0s and 1s with an equal count of 0s and 1s.
Check if Count of 1s can be Made Greater in a Binary string by Changing 0s Adjacent to 1s
In this blog, we will discuss a coding challenge that involves the use of sorting and greedy algorithms. Greedy algorithms are well known for their simplicity and ease to understand.
Find the Length of Smallest Non-Prime Subsequence in a Numeric String
In this article, we will solve a programming problem where we need to design an algorithm to find the length of the smallest non-prime subsequence in a given numeric string.
The Largest Prime Number Possible from a Subsequence of a Binary String MEDIUM
The following article discusses how to find the largest prime number formed from the subsequence of the given Binary String along with its implementation in C++, Java, and Python.
Compute the Count of K Length Subarrays Containing Only 1s in Binary String
This article will give you an overview of the implementation of subarrays related problems through Computing the Count of K Length Subarrays Containing Only 1’s in Given Binary String.
Find the Kth lexicographically smallest string with unique products for all the substrings
In this article, we will learn to find the Kth lexicographically smallest string of integers of length N such that each substring's products should be unique.
Compare Version Numbers MEDIUM
This blog will discuss, how can we compare two different version numbers. We will look at the implementation in different languages.
Count and Say MEDIUM
In this blog, we will discuss recursive and iterative solutions to the problem count and say.
Ninja and his Strings
This article will discuss the problem “Ninja and his strings”, solution approach to the problem, its C++ implementation, and its time and space complexities.
String Hashing
In this blog, we will learn what string hashing is and how it is helpful in comparing two strings efficiently.
Maximize the Confusion of an Exam
In this blog, we will discuss an exciting problem, namely “Maximize the confusion of an Exam”. It is an ad-hoc problem.
Prefix function - Knuth-Morris-Pratt Algorithm
In this article, we will learn Knuth-Morris-Pratt or KMP Algorithm.
Lexicographically largest String after removal of K characters
This article covers the approach to the problem lexicographically largest string after removing k characters and its implementation in C++.
Author Spider
0 upvotes
Find All Words in the Given Sentence that are Lexicographically Increasing and Lexicographically Decreasing
This blog will discuss how we can solve the problem find all words in the given sentence that are lexicographically increasing and lexicographically decreasing.
Minimum Count of Inversion Pairs Possible by Concatenating N Binary Strings in any Order
In this blog, we will learn to solve a problem based on sorting. We will discuss the problem minimum count of inversion pairs possible by concatenating ‘N’ binary strings in any order.
Bitwise Operators in C/C++ EASY
This article discusses the types of Bitwise Operators in C/C++ and their use.
Bit Manipulation for Competitive Programming EASY
This article discusses Bit Manipulation for Competitive Programming with examples. You will learn the representation of decimal numbers in binary and binary operators.
Total Hamming Distance
This article will brief you about the hamming distance between two integers is the number of positions where the corresponding bits will be different.
Ugly Numbers 2
This article discusses the problem of Ugly Numbers 2, where we have to find the nth ugly number.
Author
1 upvote
Find Elements
In this blog, we will discuss a famous interview coding question, “Find Elements” and its various solutions.
Bitwise AND of Numbers Range
This blog will discuss the different ways to solve the problem of bitwise AND of Numbers Range, subsequently discussing the time and space complexity.
Longest Consecutive Sequence of 1’s in the Binary Representation of a Number
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.
Minimum X (xor) A
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.
Lucky Alive Person in a Circle MEDIUM
This blog will help you build logic for one of the famous puzzles Lucky Alive Person in a Circle, and its implementation in C++, Java, and Python.
Count Number of Set Bits in an Integer EASY
Count the total number of set bits in a given integer using a simple and efficient algorithm. Learn how to count set bits in Python, C++, and Java.
Gray Code
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.
Number of Steps to Reduce a Number in Binary Representation to One
In this, we will discuss the problem i.e number of steps to reduce a number to one and its approach to code.
Divide Two Integers EASY
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.
Binary Numbers of N digits
This article discusses the Problem of printing all Binary Numbers of N digits
Generate All Binary Numbers in the Range [L, R]
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]’.
Find a Number X Such that XOR of Given Array after Adding X to Each Element is 0
In this article, we will solve a bit manipulation problem that will help you to get a good grasp on bits.
Count of Subsets having Maximum Possible XOR Value MEDIUM
In this blog, we will solve an interesting coding challenge using dynamic programming and the gaussian elimination technique. Dynamic Programming and XOR operation are well-known topics asked in coding interviews.
Convert given binary to its equivalent ASCII character string MEDIUM
In this article, we will learn how to convert a given binary string to its equivalent ASCII character string
Count Set Bits in Index Range [L, R] in Given Array for Q Queries
In this article, we will learn how to count set bits in index range [L, R] in the given Array for Q queries.
Count Total Set Bits in an Array EASY
In this blog, we will discuss solving the problem of counting total set bits in an array.
Form a Number Using Bit Rotations of N having the Same Frequency of each Digit
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.
Maximize Bitwise AND of the array by replacing at most one element
This article will discuss the problem to maximize bitwise AND of the array by replacing at most one element
Bit Stuffing and Bit Destuffing MEDIUM
In the following blog, we discuss the bit stuffing and bit de-stuffing problems using one of the most intuitive yet optimal approaches involving elementary logic and understanding of loops.
Space optimization using bit manipulations
This article explains how space optimization works and how to perform space optimization using the bit manipulation technique.
Find the maximum product of Bitwise AND and Bitwise OR of K-size subarray
This article will discuss the problem to find the maximum product of Bitwise AND and Bitwise OR of K-size subarray
Find the size of the largest subset with bitwise AND greater than their bitwise XOR
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.
Find the total number of subsequences having odd Bitwise AND values in the array
This article explains how to determine the total number of subsequences having odd bitwise and values in the array.
Find the total number of subsequences having odd Bitwise OR values in the array
This article explains how to determine the total number of subsequences having odd bitwise OR values in the array.
Maximize sum of LSBs of Bitwise OR of all possible N/2 pairs from given Array
The blog aims to find the maximum sum of LSBs of Bitwise OR of all possible N/2 pairs from the given Array.
Find the next greater number formed with exactly two unique digits for each array element
This article describes how to find the next greater number formed with exactly two unique digits for each array element

Advanced Level

Welcome to the Advance Level of this journey of becoming a competitive programmer! This section deals with more complex problems and data structures and will help you understand these topics in depth, this section contains some of the problems and topics which are often asked in interviews and contains solutions for those problems, but before looking at the problems just focus on attempting the problem yourself.
Segmented Sieve MEDIUM
In this problem, we are going to learn a very important concept in number theory, “Segmented Sieve”. We are also going to analyse the space and time complexity of the approach.
Sieve of Eratosthenes with Linear time complexity
This blog covers the basic concepts of the sieve of Eratosthenes done within linear time complexity.
Integer Factorization
Learn different methods to perform integer factorization of prime and composite numbers.
Primality Tests
In this blog, we will discuss naive tests and the Fermat tests to check whether a given number is prime or not.
Maximize Product of Min Value of Subarray and Sum of Subarray Over All Subarrays of Length K HARD
In this blog, we will see how we can solve the problem of maximizing the product of min value of subarray and sum of subarray over all subarrays of length K’.
Modular Exponentiation
In this article, we'll learn everything about Modular Exponentiation, their operations, and applications and we will learn how they optimize various computer science processes.
Kth Smallest Prime Number in range L to R for Q queries
This blog will discuss how we can solve the problem named ‘Kth smallest Prime Number in range L to R for Q queries’.
Find Prime Numbers in a 2D Array (Matrix) EASY
The following blog discusses the problem 'Find Prime Numbers in a 2D Matrix' along with some approaches to solve it in an efficient manner.
Minimum steps to reduce N to a prime number by subtracting with its highest divisor
This article discusses the approach to finding the minimum steps required to reduce N to a prime number by subtracting with its highest divisor with its implementation in C++.
Author Spider
0 upvotes
Minimize Swaps Required to Make All Prime-indexed Elements as Prime
The task is to make all prime-indexed elements of the array prime with minimum swaps.
Find Any Prime Number P contains given Number N.
In this article, we will discuss the problem of finding the Prime Number P contains given Number N in it.
Make two numbers equal by multiplying with their prime factors the minimum number of times
This blog finds the minimum number of operations needed to make two numbers equal by multiplying with their prime factors
Segregate Prime and Non-Prime Numbers In An Array MEDIUM
The following article discusses an approach to solve the problem of segregating the numbers into two parts Prime and Non-Prime Numbers along with its implementation with helo of few examples.
Program To Find The Nth Composite Number
This article discusses the problem of finding the Nth Composite Number
Find the Shortest Path From One Prime to the Next by Changing One Digit at a Time MEDIUM
In this blog, we will discuss the problem to find the shortest path from one prime to the next by changing one digit at a time.
Number of ways you can always stay either above or below the main diagonal
This blog will cover how to find the number of ways you can always stay either above or below the main diagonal and discuss their Time and Space complexity.
Count all binary strings having length N and contain at least X 0's and Y 1's.
This article will discuss the problem of finding the count of all binary strings having length N that contains at least X 0’s and Y 1’s.
Count of numbers of length N having odd numbers at even indices and prime numbers at odd indices
This article discusses the approach to count the numbers of length N having odd numbers at even indices and prime numbers at odd indices and its implementation in C++.
Author Spider
0 upvotes
Minimum Adjacent Swaps of the Digits Required to Make N Divisible by K MEDIUM
This article discusses the approach to finding the minimum adjacent swaps of the digits required to make N divisible by K with its C++ code.
Author Spider
0 upvotes
Maximum product of integers formed by splitting digits of N into two parts in any permutation
This article discusses the approach to maximize the product of integers formed by splitting the digits of N into two parts in any permutation with its C++ code.
Author Spider
0 upvotes
Count of all the possible combinations of K numbers that sum up to N
This article discusses the different approaches to counting all possible combinations of K numbers that sum up to N.
E. Counting Arrays EASY
In this article, we will solve one of the popular problems, E. counting arrays
Binomial Coefficients MEDIUM
This blog will discuss the topic of binomial coefficients, including the brute force approach and optimal approach.
Nice Permutations
This article will discuss the problem “Nice Permutations”, solution approach to the problem, its C++ implementation, and its time and space complexities.
Author Riya
1 upvote
Number Of Ways To Form A Team Of Size K Having At Least 4 Boys And 1 Girl.
Modulo Fermat's Theorem
This blog will discuss a famous number theory question - Modulo Fermat's Theorem.
Stickman Tree EASY
This article discusses the problem of "Stickman Tree".
Ninja and Chains
This blog will discuss how we can solve a problem - Ninja and Chains.
Modular exponentiation with GCD
This article discusses the solution to the problem “Modular exponentiation with GCD”.
Hidden squares
In this article, we will solve a number theory problem, the concealed square.
Single Number III
In this blog, we will find the two elements that appear only once in an array where two elements appear only once, and all the other elements appear exactly twice.
Remainders Game
This article will discuss the solution for the problem statement “ Game of Remainders”. Along with the solution, the article focuses on the time and space complexity of the solution.
Aman and Multiplicative Queries for two arrays
This article will discuss the solution for the problem statement “Multiplicative Queries for two arrays”. Along with the solution, the article focuses on the time and space complexity of the solution.
Modular Arithmetic
This article discusses and explains fundamental modular arithmetic operations.
Binary Exponentiation
This article discusses the binary exponentiation method.
Extended Euclidean Algorithm
In this article, we briefly discuss working and proof of Extended Euclidean Algorithm.
Introduction to Chinese Remainder Theorem
In this article, we will learn about the Chinese Remainder Theorem discovered by a Chinese mathematician Sun Zi. It is an important theorem, so read until the end to understand better.
Euler’s Totient Function
This blog will cover the theory and implementation part of Euler’s Totient function and discussion over its Time and Space complexity.
Modular Multiplicative Inverse EASY
In this article, we discuss the implementation of brute force and optimized approaches in detail to calculate the modular multiplicative inverse.
Number Of Ways To Get A Sum Equal To N Using Odd Consecutive Natural Numbers
In this article, we will discuss finding the number of ways to get a sum equal to N by adding consecutive odd natural numbers. We will also focus on the complexity of our solution.
Combinatorics (BASICS)
In this article, we will learn about the basic principles of combinatorics.
Pascal Triangle
This article will cover Pascal's triangle & combinatorics topic with a detailed explanation.
nCr - Binomial Coefficient
In this article, we will learn what binomial coefficients are and then will solve various problems using them. We will also look at different ways to compute Binomial Coefficients.
Compute nCr % x
This article will discuss the solution to 'Compute nCr % x'.The article will discuss the different approaches along with the time and space complexity of both solutions.
Lucas Theorem
This article will discuss “Lucas Theorem”.
Author Riya
1 upvote
Fermat's Theorem
In this article, we briefly discuss Fermat's Little Theorem, its proof and code for finding the modular multiplicative inverse.
Strictly Increasing Elements Between a Range
The task is to find the number of ways to select strictly increasing elements between a given range.
N-Dimensional Plane
In this blog, we will learn to solve a problem based on the N-Dimensional plane.
Bee Mesh
This blog will discuss how we can solve one of the most asked problems in backtracking, i.e., Bee Mesh.
Attractive triplets
This article discusses the solution to the problem of attractive triplets.
Find the Array which when sorted forms an AP and has Least Maximum
This article will discuss the problem "Find the array which when sorted forms an AP and has least maximum," the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
1 upvote
Count of Arrangements of RGB balls with No Duplicates in a Set MEDIUM
In this blog, we will calculate the minimum required sets to place all the red, green and blue balls.
Minimum Operations Necessary to Reduce N to 0 by Substituting N with N/M or Increasing M by 1
Minimum number of operations required to reduce N to 0 by substituting either N with N/M or increasing M by 1.
Smallest divisor of N closest to X
This article discusses the different approaches to find the Smallest divisor of N closest to X with a complete explanation in C++.
Author Spider
0 upvotes
Check if a Number can be Expressed as Product of a Prime and a Composite Number
In this blog we will discuss a coding challenge based on factorization techniques. We will see how to implement Sieve of Eratosthenes to identify prime numbers upto a given limit.
Count of numbers from the range [L, R] whose sum of digits is Y
In this blog, we will discuss a range query problem named count of numbers from the range [L, R] whose sum of digits is Y.
Count of all Possible N Length Balanced Binary Strings MEDIUM
In this blog, we will solve and discuss the Count of all Possible N Length Balanced Binary Strings in both DP, and Binomial Coefficient approaches.
Count Prime in Ranges
This blog discusses a famous interview problem, count prime in ranges. Given a range L and R, we need to find the number of primes between L and R inclusive.
Author Jay
1 upvote
Minimize the count of integers to be added in Array to make each adjacent pair co-prime
This article will brief you on the problem to minimize the count of integers to be added in an array to make each adjacent pair co-prime.
Find the longest subarray with Prime sum in given Array
This article explains the problem to find the longest subarray with a prime sum in a given array.
Count array elements whose count of divisors is a prime number
This article will brief you on the problem to Count array elements whose count of divisors is a prime number.
Prime Numbers from 1 to N that can be Represented as a Sum of Two Prime Numbers
Prime numbers have only two factors, 1 and themselves. In this article, we will write an algorithm to count prime numbers from 1 to N that can be written as a sum of two prime numbers.
Find Kth Number, Which can be Written as the Sum of Powers of ‘N’
In this blog, we will learn to solve a problem based on bit manipulation.
Distinct Passwords
The blog aims to teach to calculate the total number of distinct passwords.
Counting Triangles in a Rectangular space using BIT
In this article, we will discuss the approach to count the number of triangles that can be formed by connecting the points inside a rectangle for multiple queries. We will also focus on the complexity of our approach.
Karatsuba Algorithm for fast multiplication of large decimal numbers represented as strings
This article discusses the Karatsuba algorithm, its intuition and C++ code
Find the remainder when a number A raised to N factorial is divided by P
This article will brief you on the problem to find the remainder when a number A raised to N factorial is divided by P.
The Number of Unordered Pairs of Semiprime Numbers with a Prime Sum in the Range 1 to N
In this article, we will design an algorithm for counting the number of unordered pairs of semiprime numbers in the range [1, N], whose sum is a prime number.
Count the permutations of first N positive integers such that the sum of any two consecutive numbers is prime
In this blog, we will discuss the problem: Count the permutations of first N positive integers such that the sum of any two consecutive numbers is prime. We will also discuss the time and space complexity of the approach discussed.
Count the Possible Sets Using Integers from a Range [2, N] Using Given Operations that are in Equivalence Relation
This article will cover the problem Count of Sets Possible using Integers from a Range[2, N] using Given Operations in Equivalence Relation and its implementation.
Count of sorted triplets (a, b, c) whose product is at most equal to N
In this article, we will discuss the problem to count of sorted triplets (a, b, c) whose product is at most equal to N.
Count of Arrays of Size N that can be Formed Starting With K Such that Every Element is Divisible by the Next Element
In this article, we will design an algorithm for counting the number of the N-sized arrays that can be formed starting with K such that every element is divisible by the next element.
Count of Numbers in Range [L, R] having Sum of Digits of its Square Equal to Square of Sum of Digits
In this article, we will learn how to count of numbers in range [L, R] having sum of digits of its square equal to square of sum of digits.
Number of Ways to Draw K Rectangles Completely Inside Each Other
In this article, we will learn to count the number of ways to draw K rectangles in a 2D grid, such that the current drawn rectangle is completely inside the last-drawn rectangle. We will also focus on the time and space complexity of our solution.
Find the number formed by K times, alternatively reducing X and adding Y to 0
This article will brief you on the problem to Find the number formed by K times, alternatively reducing X and adding Y to 0.
Fermat’s Factorization Method
This blog discusses Fermat’s factorization method for breaking a number into its factors. This is a very useful method to find factors of a number.
Chinese remainder theorem EASY
The article covers the Chinese remainder theorem, its working with hands-on examples, and its implementation with a naive and efficient approach.
Euclidean Algorithm
This blog will cover the theory, implementation, and discussion over the Time and Space complexity of the Extended Euclidean Algorithm.
Multiplicative Inverse
In this article, we will learn how to find the modular multiplicative inverse of a number ‘a’ under ‘m’, learn how to implement it, starting from a naive to an efficient approach.
Factorial Modulo
This blog covers the concepts for understanding factorial modulo with ease, its implementation and algorithm.
Binary Exponentiation MEDIUM
Binary Exponentiation efficiently calculates large exponents using binary representation. Learn how to implement Binary Exponentiation using recursion and iterative approach.
Find the Missing Digit in Given Product of Large Positive Integers
In this article, we will solve a number theory problem that can be asked in the interviews.
Count of unordered pair of indices such that the ratio of elements at these indices is same as the ratio of indices
This article will discuss the problem to get the count of unordered pair of indices such that the ratio of elements at these indices is same as the ratio of indices.
Minimize Cash Flow among a given set of friends who have borrowed money from each other
In this blog, we will be solving the problem of minimizing cash flow and the code.
Minimum initial vertices to traverse the whole matrix with given conditions
This article will discuss the solution to find Minimum initial vertices to traverse the whole matrix with given conditions. Along with the solution, the article focuses on the time and space complexity of the solution.
K Centers Problem
In this article, we will solve an NP-hard problem. One of the most important programming problems and a real-world application: The k centers Problem.
Shortest Superstring
This article discusses the Problem of the Shortest Superstring.
Jump Game
This blog will cover two different approaches to the problem Jump Game with an explanation and their C++ code.
Jump Game II
In this blog, we will build logic for the problem of minimum jumps and other problems related to this.
Get Equal Substrings Within Budget
This blog will be discussing the problem Get Equal Substrings Within Budget along with its time and space complexity.
Number of wonderful substrings
This blog finds the number of wonderful substrings in a given string.
Minimum count of Inversion Pairs possible by concatenating N binary strings in any order HARD
The following blog discusses how to find the Minimum count of Inversion Pairs by concatenating N binary strings in any arbitrary order along with its implementation.
Minimum Decrements to Make an Array at Most Zero Such That All Array Elements Are Cyclically Decremented After a Number is Reduced to Zero
In this blog, we will learn to solve a problem, minimum decrements to make an array at most zero such that all array elements are cyclically decremented after a number is reduced to zero.
Lexicographically Incrementing or Decrementing Characters to Convert Characters of STRING1 to Characters Present in STRING2
The task is to find the minimum operations to convert the characters of string1 to the character present in string2.
Sum of beauty in the array
This article discusses the different approaches to finding the sum of beauty in the array with examples and its implementation in C++.
Author Spider
0 upvotes
Rearrange Positive and negative numbers in O(n) time and O(1) extra space MEDIUM
In this article, we will discuss a very interesting problem, in which we have to rearrange the positive and negative numbers such that they will occupy alternate positions, and all extra positive or negative elements will be put an end.
Rearrange Positive and Negative Numbers With Constant Extra Space | Part 2 EASY
This blog mainly focuses on the problem, namely, Rearrange Positive and Negative Numbers With Constant Extra Space. We will discuss the Merge Sort Technique to solve this problem with a proper explanation and flow diagram.
Merge Intervals
In this article, we’ll learn how to merge intervals to make them mutually exclusive.
k smallest elements in the same order using O(1) extra space
In this article, we will discuss how to find the ‘k’ smallest elements in the same order, in detail.
Find the Maximum Repeating Number in O(N) Time and O(1) Extra Space
In this blog, we will discuss a tricky coding problem and try to solve it within the given constraints.
Maximum Disjoint Intervals
This article will brief you on finding the Maximum Disjoint Intervals.
Reduce array to a single element by repeatedly removing an element from any increasing pair
This article will discuss the solution of the problem “Reduce the array to a single non-zero element by repeatedly removing an element from any increasing pair” along with the time complexity and space complexity of the solution
Divide 1 to n into two groups with a minimum sum difference
In this article, we will solve one of the most asked coding problems: divide 1 to n into two groups with a minimum sum difference.
Minimum Number of Arrows to Burst Balloons
This article explains how to solve the problem of finding the Minimum Number of Arrows to Burst Balloons.
Find Minimum Number of Arrows Needed to Burst all Balloons
This article will discuss the problem "Find the minimum number of arrows needed to burst all balloons," the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
2 upvotes
Equilibrium Point MEDIUM
The equilibrium index of an array is the index at which the sum of the components at lower and higher indices is equal.
Product of array except self
This article will brief you on the problem “product of array except self”.
Implementing Sets Without C++ STL Containers
In this blog, we will learn about the implementation of Set without using C++ STL containers.
Count the Total Numbers With No Repeated Digits in a Range MEDIUM
The following article discusses the problem 'Count the total numbers with no repeated digits in a range' along with its implementation in C++ language.
Maximize count of distinct elements in a subsequence of size K in given array
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.
Find numbers in the range [L, R] that are coprime with all given Array elements
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++.
Author Spider
0 upvotes
Count Of Pairs In Given Array Whose GCD Is Not Prime
This article will discuss to count the pairs in the given Array whose GCD is not prime and the approach to solve this problem.
Introduction to Segment Trees
In this article, we will see an introduction to segment trees. A segment tree is an advanced data structure used to solve range-based queries.
Segment Tree
This article introduces segment trees and explains their implementation to answer range sum queries.
Merge Sort Tree For Range Order Statistics
This blog will discuss an exciting problem: Merge Sort tree for range order statistics. It is based on an advanced data structure called merge sort trees(segment tree). We will discuss the space and time complexity of the approach discussed.
Length of Longest Increasing Subsequences (LIS) using Segment Tree
In this article, we will take a coding problem based on the concept of the Longest Increasing Subsequence. We will solve this problem using a segment tree.
Count of Xs in the Array for a given range of indices after array updates for Q queries
This article will discuss the solution for the problem statement ‘Count of Xs in the Array for a given range of indices after array updates for Q queries’.The article will discuss both naive and optimized approaches along with the time and space complexity of both solutions.
Longest Subarray with GCD Greater than 1
In this blog, we will learn to solve a problem based on longest subarray with GCD greater than 1.
Queries to Calculate the Sum of the Array Elements Consisting of an Odd Number of Divisors
In this article, we will design an algorithm to solve all of the queries about calculating the sum of the elements of an array in a given range with an odd number of divisors.
Queries to Calculate Sum of Squares of ASCII Values of Characters of a Substring with updates
In this article, we will solve a problem using the segment tree data structure.
Queries to calculate sum of squares of array elements over range of indices [L, R] with updates
In this article, we will solve an online range query problem using the segment tree data structure with lazy propagation.
Range Update in a Segment Tree without using Lazy Propagation and Point Query
This article will discuss the solution to do Range Update in a Segment Tree without using Lazy Propagation and Point Query along with the solution, the article focuses on the time and space complexity of the solution.
Queries to Count Array Elements from a Given Range having a Single Set Bit
In this article, we will learn how to count array elements from a given range having a single set bit.
Queries to Find The First Array Element Exceeding K with Updates
In this article, we will learn how to to find the first array element exceeding K with updates.
Maximize value of a pair from two given arrays based on given conditions
The blog aims to introduce you to solve a problem having two arrays and some given conditions.
Range minimum query
In this article, we will see how to solve the problem, Range minimum query.
Queries to find the min index in a range [L, R] having at least value ele with updates
This article will discuss the solution of the problem statement “Queries to find the min index in a range [L, R] having at least value ele with updates” along with the solution, the article focuses on the time and space complexity of the solution.
Queries to calculate sum with alternating signs of array elements in a given range
This article will discuss the problem "Queries to calculate sum with alternating signs of array elements in a given range," the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
1 upvote
Maximize sum of array by reducing array elements to contain no triplets (i, j, k) where a[i] < a[j] and a[i] < a[k] and j <i < k
In this article we will discuss the approach to maximize the sum of array by reducing its elements by 1 such that it contains no triplets (i,j,k) where a[i] < a[j] and a[i] < a[k] and j < i < k along with it’s space and time complexities.
Query to find the length of the longest subarray consisting of only 1s
In this blog, we are going to discuss a really interesting problem: Query to find the length of the longest subarray consisting of only 1s. We are going to discuss two approaches, first the naive one and then the efficient solution. We will analyze the space and time complexity of the approaches discussed.
Maximum length of same indexed subarrays from two given arrays satisfying the given condition
This article will take a coding problem based on Binary Search and Segment Tree. A segment tree is an advanced data structure used to solve range-based queries.
Queries to Count Array Elements Greater Than or Equal to a given Number with Updates
This article will take a coding problem based on Arrays. Array-based questions are very prevalent in interviews/coding rounds.
Maximize the length of longest subarray consisting of same elements by at most X decrements
This article will discuss the solution of the problem statement "Maximize the length of longest subarray consisting of same elements by at most X decrements" along with the solution. The article focuses on the time and space complexity of the solution.
Queries to Evaluate the given Expression in a range [L, R]
This article will discuss the problem "Queries to evaluate the given equation in a range [L, R]," the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
0 upvotes
Find Value After N Operations to Remove N Characters of String S with Given Constraints
In this article, we will learn how to find value after N operations to remove N characters of string S with given constraints.
Sum of previous numbers that are greater than current number for given array
In this article, we will take a coding problem based on the application of the Fenwick Tree, also known as the Binary Indexed Tree. Fenwick trees are used to calculate prefix sum efficiently and handle updates efficiently.
Finding XOR of the Array Elements in a Given Range with Updates using Fenwick Tree
In this article, we will design an algorithm to solve the queries of finding the XOR of array elements in a given range with updates of array values using the Fenwick Tree.
Queries for the Number of Nodes having Values Less than V in the Subtree of a Node
In this article, we will take a coding problem based on the application of the Fenwick Tree, also known as the Binary Indexed Tree. Fenwick trees are used to calculate prefix sum efficiently and handle updates efficiently.
Find the Number of Pair of Ideal Nodes in a Given Tree
This article will discuss the problem "Find the number of pair of ideal nodes in a given tree", an approach to solve this problem, its C++ implementation, and time and space complexity.
Author Riya
1 upvote
Range Sum Queries and Update with Square Root
This article will cover the approach and implementation of the problem- Range Sum Queries and Update with Square Root.
Number of elements greater than K in the range L to R using Fenwick Tree (Offline queries)
This article will discuss finding the number of elements greater than K from index L to R for offline queries using the Fenwick Tree. We will also focus on the complexity of our solution.
Count of Inversion of size K in a given array
This article will discuss the problem "Count of Inversions of size K in a given array," an approach to solve this problem, its C++ implementation, and time and space complexity.
Author Riya
1 upvote
XOR of Numbers that Appeared Even Number of Times in Given Range
In this article, we will take a coding problem based on the application of the Fenwick Tree, also known as the Binary Indexed Tree. Fenwick trees are used to calculate prefix sum efficiently and handle updates efficiently.
Sum of Interval and Update with Number of Divisors
In this article, we will discuss the approach to find the sum of a segment of an array and update a segment by replacing every number with its number of divisors for multiple queries. We will also focus on the complexity of our approach.
Maximum Sum of Increasing Subsequence using Fenwick Tree
This article will discuss the solution for finding the Maximum Sum of Increasing Subsequence using Fenwick Tree along with the solution; the article focuses on the time and space complexity of the solution.
Queries for Number of Distinct Elements in the Subarray
In this article, we will discuss the approach to finding the number of distinct elements in the subarray for multiple queries. We will also focus on the complexity of our approach.
Number of Elements less than or equal to a given number in a given subarray
This article will discuss the problem "Find the number of elements less than or equal to a given number in a given subarray, its C++ implementation, and time and space complexity.
Author Riya
1 upvote
Count Inversions using Fenwick Tree
The article covers the use of the Fenwick tree to determine the inversion count in an array
Two Dimensional Fenwick Tree
This article will discuss the Two Dimensional Fenwick Tree concept and its application and its space and time complexity.
Binary Indexed Tree or Fenwick Tree
In this article, we will learn Binary Indexed Tree or Fenwick Tree.
Binary Indexed Tree or Fenwick Tree
In this article, we will discuss Binary Index Tree/Fenwick Tree and see its implementation in c++.
Binary Indexed Tree: Range Update and Range Queries
This article describes the methods to do range update and range queries on a binary indexed tree
Range Update and Range Queries in Binary Indexed Tree
This article will discuss "Range update and Range Queries in Binary Indexed Tree," its C++ implementation, and time and space complexity.
Author Riya
1 upvote
Querying the Number of Distinct Colors in a Subtree of a Colored Tree using BIT
This article will solve a problem on trees using the binary index tree/Fenwick tree. Through this article, we will learn an algorithm to flatten the given tree and see an application of the binary index tree.
Minimum Possible Integer After at Most K Adjacent Swaps On Digits
In this blog, we will discuss an interesting interview problem, namely the minimum possible integer after at most K adjacent swaps on digits. It is a Leetcode Hard problem.
The Skyline Problem
This article discusses The Skyline Problem, which is one of the most challenging questions asked in interviews of tech giants.
SQRT Decomposition EASY
In this blog, we will learn about the SQRT Decomposition algorithm along with an example and will also have a look at its time and space complexity of it.
Sqrt Decomposition Method
In this article, we will learn the importance of the sqrt decomposition method and how it will help optimize query problems.
Sqrt (Square Root) Decomposition EASY
This article will discuss the concept of “sqrt decomposition” and the solution of an example problem using “sqrt decomposition”, its C++ code, and its time and space complexity.
Author Riya
1 upvote
Find jth Smallest Value Present on the Simple Path between Two Nodes MEDIUM
Find jth Smallest Value Present on the Simple Path between Two Nodes of an undirected graph.
SEAD Problem (Codechef) EASY
This article discusses the  ‘SEAD’ problem on CodeChef and its approach.
Matchstick Problem
In this article, we will design an algorithm to solve the queries about the time taken in burning all the matchsticks.
Monster Kill
The task is to find out the longest consecutive subsegment satisfying the mentioned conditions.
Find the S-value of the Given Subarrays Using Mo’s Algorithm
This article will solve a range query problem using square root decomposition/Mo's algorithm.
Mex Puzzle
This blog will discuss how we can solve a problem - Mex Puzzle.
Ninja’s Messenger
This article will discuss the problem “Ninja’s Messenger,” solution approach to the problem, its C++ implementation, and its time and space complexities.
Author Riya
1 upvote
Frequency Range Count
In this blog, we will learn to solve a problem based on the Range theory.
Coprime Queries on Trees
For a given tree with N nodes, the task is to solve the given queries.
Count on a Tree - 2
In this article, we will learn the way to find the number of distinct node values in a path between two nodes.
Sum of All Elements With Odd Frequency in the Given Subarray
In this blog, we will learn to solve a problem based on a range query, the sum of all elements with odd frequency in the given subarray.
Mo's Algorithm
This blog will discuss a famous competitive programming algorithm - Mo’s Algorithm.
Mo's Algorithm With Updates (SUM query)
This blog will discuss a variation famous competitive programming algorithm - Mo’s Algorithm with Updates.
DQUERY - SPOJ
The article describes how to find the number of distinct elements in the given range.
Mo’s On Trees and SQRT Decomposition
In this article, you will learn about Mo’s algorithm and SQRT Decomposition for trees
Priority Queue of Pairs In C++ with Ordering MEDIUM
This blog covers the approach for priority queue of pairs in C++ with ordering, In this we will see the implementation for both order by first element of pair as well as order by second element of pair.
Kth Smallest Element in a Row-Wise and Column-Wise sorted 2D Array MEDIUM
In this blog post, we will learn various algorithms to find the Kth smallest element in a row-wise and column-wise sorted 2D array and its implementation in C++.
Connect N ropes with minimum cost HARD
This article will brief you on the problem connect N ropes with minimum cost.
Sum and Product of K Smallest and Largest Fibonacci Numbers in the Array HARD
This article discusses how to find the sum and product of K smallest and largest Fibonacci numbers in the array.
The Maximum Sum of Two Non-Overlapping Intervals in a List of Intervals | Interval Scheduling Problem
This article will discuss the maximum sum of two non-overlapping intervals in a list of Intervals | Interval Scheduling Problems.
Find The Minimum Range Size That Contains The Given Element for Q Queries
In this article, we will see the approaches to find the minimum range size that contains the given element for Q queries.
Lexicographically Largest String using at most K Swaps at Same Parity Indices MEDIUM
This article will teach how to find the lexicographically largest string using at most K swaps at the same parity indices while discussing the time complexity of the program and its implementation in C++, Java, and Python.
Create Arithmetic Progressions in the Array EASY
In this blog, we will discuss a problem with arithmetic progressions in the array and its efficient solution.
Creative Sorting problem MEDIUM
In this blog, we will discuss a problem based on arrays and sorting, which is the creative sorting problem.
Find the Minimum Length Unsorted Subarray, Sorting Which Makes the Complete Array Sorted
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.
Maximum Gap
Our task in this problem would be to find and return the maximum Difference between any two consecutive elements in a sorted array.
Median Again
This blog will cover the approach and implementation of the famous sorting problem, i.e., the Median Again.
Maximum Score Difference
Arrays and Sorting are widely asked topics in coding interviews. This article will look at a problem involving arrays, sorting, and binary search.
Smallest subarray to sort in the given array
This article explains the various approaches to the problem of finding the smallest subarray to sort in a given array.
Maximum Divisors in a Range
This article will discuss the problem of finding the maximum divisors in a range.
Maximum Sum Path
This article will discuss the problem of finding the maximum sum path from two arrays.
Minimum Loss
In this article, we will discuss the problem of finding the minimum loss under the given conditions.
Find the Minimum Difference Between any Two Elements
In this article, we will learn to find the minimum difference between any two elements from a given array.
Find all indices of a given element in the sorted form of the given array
This article covers finding all indices of a given element in the sorted form of the given array.
Sort given Array using at most N cyclic shift on any subarray
In this article, we will learn how to sort a given Array using at most N cyclic shift on any subarray.
Kth lexicographically smallest distinct String from given Array of Strings
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.
Author Riya
1 upvote
How to sort and separate even and odd numbers in an array using a custom comparator?
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.
Author Spider
0 upvotes
Minimize the number of Knapsacks with total weight W required to store Array containing elements greater than W/3
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
Sorting by combining Insertion Sort and Merge Sort algorithms
In this article, we will discuss a sorting algorithm that is made by combining insertion sort and merge sort.
Non-Overlapping Intervals
This article will brief you on finding the number of overlapping intervals to be removed to maximize the Non-Overlapping Intervals.
Chocolate Distribution Problem EASY
The Chocolate Distribution Problem is a problem where you have a certain number of chocolate packets and must distribute them among a given number of children.
Magnetic Force Between Two Balls
In this article, we will learn how to solve the problem, magnetic-force-between-two-balls

Ninja Level

Welcome to the Ninja Level section of this category, so far you must have solved hundreds of questions as a competitive programmer if you've solved the previous sections thoroughly. Now you'll be challenged with Ninja Level problems and topics that help you become a Ninja Programmer. Problems and Topics in this section are the most important ones and are often asked in job interviews and hackathons, and solving them will help you crack your dream jobs easily.
0-1 BFS EASY
This blog will explore the 0-1 BFS Algorithm: Approach, Example, and C++ Code Implementation.
Author Spider
2 upvotes
01 Matrix
In this blog, we will discuss one of the famous and important questions from the interview perspective, i.e., 01 Matrix.
Topological sort without Kahn’s algorithm EASY
This article will discuss an alternative approach to Khan’s algorithm for topological sorting.
Stepping Numbers
This article discusses finding stepping numbers in a given range using Brute Force and DFS.
Beautiful Arrangement MEDIUM
This article will discuss the Beautiful Arrangements problem and various ways to solve this problem, starting from the brute force approach to the efficient approach.
Understanding Stock Span MEDIUM
In this blog, we will discuss about Understanding Stock Span problem.
Shortest path in a directed acyclic graph EASY
Find the shortest path from any node to any other node in a directed acyclic graph by approaching the problem using a brute force approach. Read on!
Shortest Path in an Unweighted Graph HARD
Let's discover the shortest path in an undirected graph. Learn efficient algorithms for finding optimal routes in unweighted graphs.
Minimum possible modifications in the matrix to reach the destination
In this article, we are going to learn how to convert a matrix problem into a graph problem and solve it using graph algorithms.
Articulation Points in a Graph HARD
A vertex is called an articulation point or a cut vertex if removing it disconnects the graph. In this article, we will write an algorithm to find all articulation points in a given graph.
Find First Undeleted Integer From K to N in Given Unconnected Graph After Performing Q Queries. HARD
In this article, we will discuss how to find the first undeleted integer from K to N in the given unconnected graph for Q queries of two types - delete K and find the first undeleted integer from K to N. We will also focus on the time and space complexity of our approach.
Length of Longest Increasing Sequence in a Graph HARD
In this blog, we'll be solving a fascinating problem on a graph, i.e., the length of the longest increasing sequence in a graph
Alien Dictionary
This blog will discuss how we can solve the problem ‘Alien Dictionary’
Check if there is a path of more than k length from a source MEDIUM
In this article, we will check if there is a path of more than k length from a source.
Minimum steps to reach target MEDIUM
In this blog, we will see how to solve the problem of Minimum steps to reach target.
Rotting Oranges Problem EASY
In this blog post, we’ll learn the rotting oranges problem and how to code it in C++ with brute force and a time-efficient approach.
Check if the end of the Array can be Reached from a Given Position MEDIUM
This blog will discuss the problem of checking if the end of the array can be reached from a given position.
Minimize Steps Required to Convert Number N to M.
This blog will cover the problem of finding the minimum steps required to convert the number N to M using arithmetic operators and discuss its Time and Space complexity.
Check if it is possible to reach the index with value K when the start index is given MEDIUM
This article discusses checking if it can reach value k with the start index in a given array.
Check If Cells Numbered 1 to K In A Grid Can Be Connected After The Removal Of At most One Blocked Cell EASY
This blog discusses the breadth-first search solution to the above problem and its applications.
Kahn's Algorithm for Topological Sorting
Kahn's algorithm is a topological sorting algorithm that sorts a directed acyclic graph (DAG) in linear time. This article explains the algorithm in detail, with examples and a pseudocode implementation.
Optimal read list for given number of days MEDIUM
In this article, we will check if there is a path of more than k length from a source.
All Possible Walks from a Source to a Destination with exactly k Edges MEDIUM
In this blog, we will learn to find all possible walks from a source to a destination with exactly k edges.
What is the Sieve Method? MEDIUM
In this article, we will discuss about sieve method and its working.
Channel Assignment Problem MEDIUM
In this blog, we will learn about the Channel Assignment Problem, with examples and a coding problem.
Travelling Salesman Problem | Part 2 MEDIUM
In this article, we&#39;ll be seeing the dynamic programming approach to solving one of the classic optimisation problems, i.e. Travelling Salesman Problem.
The Stable Marriage Problem MEDIUM
In this article, we will learn about a famous problem, the stable marriage problem.
Jumping Numbers Smaller Than or Equal to a Given Value MEDIUM
In this article, we will study jumping numbers and print all jumping numbers in different languages.
STL-based BFS for competitive coding MEDIUM
This blog will explain how to implement BFS using STL
Shortest distance between two nodes in a Graph by reducing the weight of an edge by half
In this article, we will discuss the problem to find the shortest distance between two nodes in a Graph by reducing the weight of an edge by half
Shortest path in a Matrix from top-left to bottom right-corner with neighbours exceeding at most K
In this blog, we are going to solve a very interesting problem: Shortest path in a Matrix from top-left to bottom right-corner with neighbours exceeding at most K. We will also see the code implementation and discuss the space and time complexity.
Minimum edges connected to node B to be removed from undirected graph to remove any existing path between nodes A and B.
In this article, we will discuss the problem to find the minimum edges connected to node B to be removed from undirected graph to remove any existing path between nodes A and B.
Minimum Vertex Cover Size of a Graph Using Binary Search MEDIUM
In this article, we will learn how to find the minimum cover size of a graph using a binary search.
Find the minimum number of edges to be removed such that no path exists between the given pair of vertices
In this article, we will learn how to determine the minimum number of edges that need to be removed from the given graph such that no path exists between the given pair of vertices.
Count the number of nodes in a Graph whose sum of neighbors is at most K
This article discusses the approach and implementation on how to count the number of nodes with the sum of neighbors at most K
Find Eventual Safe States
Learn to find the safe states in the given graph.
Count all Hamiltonian Paths in a Directed Graph MEDIUM
In this blog, we will learn how to count all hamiltonian paths in a given directed graph.
Bipartite Graph MEDIUM
This article explains the bipartite graph, its properties and algorithm to determine if a graph is bipartite or not, along with its space and time complexity.
Solving Water Jug Problem using BFS MEDIUM
This article discusses one of the famous puzzle Water Jug Problem which will be solved using BFS approach including its implementation in C++ language.
Shortest Distance Between Given Nodes in a Bidirectional Weighted Graph by Removing any K Edges
In this article, we will take a coding problem based on DFS. We will learn to explore all paths using DFS traversal and efficiently find the sum of K largest elements using minHeap.
Multi Source Shortest Path in Unweighted Graph
This blog gives an overview of Multi Source Shortest Path in Unweighted Graph.
Print all Hamiltonian Cycles in an Undirected Graph.
This article will brief you on how to Print all Hamiltonian Cycles in an Undirected Graph.
Maximum Bitwise XOR of values of nodes of an Acyclic Graph made up of N given vertices using M edges
This article will brief you to find the Maximum Bitwise XOR of values of nodes of an Acyclic Graph made up of N given vertices using M edges.
Determine whether we can travel to every node under the given conditions
In this article, we will learn whether we can travel to every node under the given conditions.
Pair of positions in matrix which are not accessible HARD
In this article, We will discuss the problem of finding Pair of positions in matrix which are not accessible.
Find palindromic path of given length K in a complete Binary Weighted Graph
This blog will discuss a problem involving palindromes and complete graphs.
Find the Roots of a Tree that gives Minimum Height HARD
This article will discuss the algorithm and implementation to find the roots of a tree that gives minimum height.
Maximize Difference between pair of Nodes in a given rooted Tree such that one Node is Ancestor of another
In this article, we will learn how to maximize the difference between pair of nodes in a given rooted tree such that one node is the ancestor of another.
Tarjan’s Algorithm to find Strongly Connected Components HARD
In this blog, we will learn Tarjan’s Algorithm to find Strongly Connected Components.
Red-Black Trees Top-Down Insertion
This article will discuss the algorithm for Red-Black Trees Top-Down Insertion along with the discussion on its space and time complexity.
Insertion in Left-Leaning Red-Black Tree
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.
Check if a given Binary Search Tree is height-balanced like a Red-Black Tree
This article discusses how to check if a given BST is height-balanced like a red-black tree.
Find the largest K for every Array element such that at least K prefixes are ≥ K.
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.
Optimal Sequence for AVL Tree Insertion
This article will discuss the problem “Optimal sequence for AVL Tree Insertion”, the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
1 upvote
Count Inversions in an Array Using AVL Tree
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.
Find the Minimum number of nodes in an AVL Tree
This article discusses how to find the minimum number of nodes in an AVL Tree with a given height.
Count of Array elements greater than all elements on its left and at least K elements on its right
This blog finds the number of array elements greater than all elements on its left and at least K elements on its right
Sort the big sized array where there are many repetitions of elements
This article will discuss the problem of sorting the big array with many repetitions of elements
Counting smaller elements on the right side
In this article, we will discuss the problem of counting smaller elements on the right side.
Suffix Trees (Implementation - Brute Force)
In this article, we discuss the implementation of a brute force algorithm to generate suffix trees and discuss applications and improvements
Find the indices of all the occurrences of a pattern in a string
In this article, we will learn to find the indices of all the occurrences of a pattern in a string.
Longest Palindromic Substring using a suffix tree
This article will discuss the solution to find the Longest Palindromic Substring using a suffix tree in an optimized way. Along with the solution, the article focuses on the time and space complexity of the solution.
Suffix String Rank Problem
In this blog, we will learn to solve a problem based on the Suffix of String.
Generalized Suffix Tree
In this blog, we will discuss the Generalized suffix tree.
Substrings and Repetitions
This blog discusses the solution to the Substrings and Repetitions problem using the suffix tree approach. It explains how to build and visualise suffix trees.
Longest Common Substring using a suffix tree
This article will discuss the solution to find the Longest Common Substring using a suffix tree in an optimized way. Along with the solution, the article focuses on the time and space complexity of the solution.
Searching All Patterns Using Suffix Tree MEDIUM
This blog will discuss how we can solve a problem - Searching All Patterns Using Suffix Tree.
Solving the I Love String Problem Using KMP Algorithm
This article will cover the unique problem of searching a substring in the main string based on String data structure and implementation.
Largest Area EASY
In this article, we will discuss the largest area problem
Length of Longest Substring Occurring in a Given Substring at Least ‘K’ Times
In this blog, we will learn to solve a problem based on the string.
Queuing Problem
This blog will discuss how we can solve the Queuing Problem using Suffix Trees.
Find the Median of BST in O(N) Time and O(1) Space
We are given a BST, and we need to find the median of BST in O(N) time complexity and O(1) space.
Kth Largest Element BST
This article will discuss the approach to find out Kth largest element in a Binary Search Tree starting from the brute force approach to the efficient approach.
Number of pairs with a given sum in a Binary Search Tree
This article will discuss the problem to find the number of pairs with a given sum in a Binary Search Tree.
Find the minimum absolute difference in two different BST
This article will brief you on how to Find the minimum absolute difference in two different BST.
Convert a Sorted Linked List to Balanced BST MEDIUM
In this blog, we will discuss how to convert a sorted Linked List to Balanced Binary Search Tree.
Check for Nodes from given two BSTs with a sum equal to X EASY
In this article, we will check if there exist two nodes in two different BSTs whose sum is equal to a given value X.
Count Number of Subsets With Given Sum MEDIUM
In this blog, we will learn how to count the subsets using naive and dynamic programming approaches.
Subset Sum Problem MEDIUM
This blog cover the popular subset sum problem along with its implementation and time and space complexity analysis.
Minimum insertion to convert the string to a palindrome
This blog will see how to calculate the minimum number of insertions to convert the given string to a palindrome string along with the discussion in time and space complexities.
Wildcard Matching EASY
Let's explore the process of solving the wildcard matching problem, where the goal is to ascertain whether a given pattern can be matched with a provided text or not.
Best time to buy and sell stock II MEDIUM
The best time to buy and sell stock is an important interview problem. This blog discusses the solution for it.
Best Time to Buy and Sell Stock III HARD
In this blog, we will discuss one of the most asked questions, i.e., the Best Time to Buy and Sell Stock III, using multiple approaches.
Best Time to Buy and Sell Stock with at most K Transactions HARD
This article explains the solution to the problem of finding the best time to buy and sell the stock with at most K transactions.
Best Time to Buy and Sell Stock with Cooldown HARD
This blog will discuss how to gain the maximum profit by buying and selling a stock multiple times with a cooldown.
Number of Unique Good Subsequences MEDIUM
The article explains the solution to the problem to find the number of unique good subsequences in a given binary string, its implementation in C++, Java, and Python, and its time and space complexities.
Minimum Score Triangulation of Polygon
This article explains the solution of minimum score triangulation of polygon using dynamic programming.
Maximum sum such that no two elements are adjacent EASY
In this article, we will discuss the problem of finding a Maximum sum such that no two elements are adjacent in an array.
Maximize the Sum of Elements ARR[i] Selected by Jumping Index by Value i EASY
This blog will discuss how we can solve the problem, maximize the sum of elements ARR[i] selected by jumping index by value i.
Maximize the sum of the product of neighboring elements of the element removed from Array EASY
In this blog, we will learn how to maximize the sum of the product of neighboring elements of the element removed from the array.
Longest Palindromic Substring
In this blog, we will cover the question Longest Palindromic Substring and discussion over its Time and Space complexity.
Tiling Problem
This blog will discuss the Tiling Problem, a fundamental problem of Dynamic Programming, and analyze its time and space complexity.
Building Bridges HARD
This article contains information on how to solve the building bridges problem using dynamic programming.
Check for Binary Search Tree
In this article, you will learn that if you are given an array and an extra condition to satisfy, how to find if a Binary Search Tree can be created from that given array or not.
Collect Maximum Points in a Grid using Two Traversals MEDIUM
In this blog, we will be solving a coding problem related to dynamic programming.
Author Harsh
0 upvotes
Minimum Number of Taps to Open to Water a Garden
In this blog, we will solve one of the problems Minimum Number of Taps to Open to Water a Garden of “Hard” categories, from brute force to an optimized approach.
Author Yogi21
0 upvotes
Rod Cutting Problem MEDIUM
The blog discusses in detail the Rod Cutting Problem. We’ll discuss many approaches to solve the problem along with time and space complexity for each method.
Author Zenith
0 upvotes
The last remaining element after repeated removal of odd and even indexed elements alternately
In this article, we will solve a DP programming problem where we have to find the last element after repeatedly removing odd and even indexed elements alternately.
House Robber MEDIUM
The following article discusses the popular 'House Robber' problem along with its implementation from the most intuitive method to the most optimal one.
House Robber 2 HARD
This article discusses the Problem and the implementation of House Robber 2, one of the most famous questions in dynamic programming.
Maximize Subsequence Sum after a Plus-Minus Sign Alternatively on Elements
In this article, we will learn how to maximize subsequence sum after putting plus minus sign alternatively on element.
Minimum Number of Days in which No Task is Performed
In this article, we will learn how to minimize the number of days in which no task is performed.
Maximize Score by Multiplying Elements of Given Array with Given Multipliers MEDIUM
In this blog, we will be solving a really interesting problem: "Maximize score by multiplying elements of given Array with given multipliers". We are also going to discuss the time and space complexity of the approaches discussed.
Minimum moves to make M and N equal by repeated addition of divisors except 1
This blog will cover the question to find the Minimum moves to make M and N equal by repeated addition of divisors except 1 and discuss its Time and Space complexity.
Count of subsets with sum equal to X
This article describes how to find the count of subsets with a sum equal to X
Expected Swaps to Sort an Array when Probability of Swapping for Every Inversion Pair is Equal
The task is to find the expected number of swaps to sort an array when the probability of swapping for every inversion pair is equal.
Longest Increasing Path in a Matrix MEDIUM
In this article, we discuss the problem Longest Increasing Path in a matrix along with how to approach solving ranging from most intuitive to most optimal solutions and their implementation.
Minimum Number of Removals to Make a Mountain Array
In this article, we discuss a famous problem, 'the minimum number of removals to make mountain array', its core approach, and implementation.
Minimum Number of Removals to Make a Mountain Array - Part 2 EASY
In this article, we will discuss a famous problem, 'the minimum number of removals to make mountain array,' its efficient approach, and implementation.
Minimum number of operation required to convert number x into y MEDIUM
In this article, we will find the minimum number of operations required to convert the number x into y.
Maximize the sum of the product of two arrays at corresponding indexes by reversing at most one subarray of the first array
This article will discuss the problem of maximizing the sum of the product of two arrays at corresponding indexes by reversing at most one subarray of the first array.
Lexicographically smallest anagram of given string in range [L, R] for Q queries
This blog will cover the question to find the lexicographically smallest anagram of the given string in the range [L, R] for Q queries
Minimum Characters Require to Remove from Binary String to Sort it in Ascending Order
In this blog, we will learn to solve a problem based on Dynamic Programming. We will discuss an efficient approach to solve the problem.
Find the Minimum Insertions in the Given String to Form a Palindrome MEDIUM
In this blog, we will learn to solve a problem to find the minimum insertions in the given string to form a palindrome based on Dynamic Programming. Here, we will discuss two approaches based on recursion and dynamic programming.
Minimize Cost to Convert all ‘0’s to ‘1’s with Cost of Converting ‘0’s Group be K and that of ‘1’ be K / 3
The task is to find the minimum cost to convert all the ‘0’s of the given binary string to ‘1’s.
Decode ways
Decode Ways: Explore various methods to decode a string with problem statements and approaches, including recursion, dynamic programming, and constant space solutions, with implementations.
Minimum and Maximum values of an expression with * and +
This article explains the solution to the problem of finding the minimum and maximum values of an expression with * and +
Number of Ways to Convert 2 into N by Squaring, Adding 1, or Multiplying with 2
In this article, we will design an algorithm for counting the number of ways to convert 2 into a given number N by squaring, adding 1, or multiplying with 2.
Number of ways of Triangulation
In this problem, we’ll learn about the Catalan series and how to find the total number of ways a polygon can be triangulated.
Count of non-decreasing Arrays C[] such that A[i] <= C[i] <= B[i] HARD
This article will discuss problem count the number of non-decreasing arrays C[] such that A[i]<=C[i]<=B[i], for all i, such that 0 <=i<=n-1.
Count subsequences with GCD equal to X
In this blog, we will discuss a problem based on dynamic programming. Dynamic programming is a well known topic asked in programming contests and coding interviews.
Maximum sum path from the leaf to leaf(Extend it to any node to any node)
In this blog, we will discuss how we can calculate the maximum sum path from leaf to leaf in a binary tree. Further, we’ll extend it to the maximum sum path from any node to any node in a binary tree.
Sum of the Length of Paths from Every Node to All Other Nodes
This article will cover the approach and implementation of the problem- Sum of the Length of Paths from every Node to all other Nodes using the Tree Rerooting technique.
Unique Binary Search Trees
This article is based on the problem of finding the total number of unique binary search trees which could be generated using ‘N’ nodes, using various approaches.
DP with Bitmasking
This blog will cover the famous NP-Hard problem Travelling Salesman Problem. We will be solving it using DP with BitMasking.
Minimum Number Of Days To Debug All Programs EASY
This article will discuss to calculate the minimum number of days to debug all programs and the approach to solve this problem.
Number of Ways to Wear Different Hats to Each Other
The blog discusses in detail the Number of Ways to Wear Different Hats to Each Other. We’ll discuss different approaches to solve the problem and time and space complexity for each method.
Author Zenith
0 upvotes
Count the number of ways you can give each person a different cap
This article explains how to count the number of ways to give each person a different cap when we have 50 different types of caps.
Count numbers from a given range whose product of digits is K
In this blog, we'll talk about two approaches to count numbers from a given range whose product is K.
Count of Numbers in the range [L, R] Whose Sum Of Digits is Y MEDIUM
In this blog, we will discuss the problem of counting the numbers in the range [L, R] whose sum of digits is Y.
Count of numbers from the range [L, R] whose sum of digits is Y
In this blog, we will discuss a range query problem named count of numbers from the range [L, R] whose sum of digits is Y.
Find Count of numbers from a given range whose product of digits is X HARD
This article will discuss the problem to find the count of numbers from a given range whose product of digits is X.
Count of N digit numbers which contains all single-digit primes
In this blog, we will discuss an interesting problem: Count of N digit numbers which contains all single-digit primes. We will also discuss the time and space complexity of the approaches discussed.
How to find all N digit numbers with at least one repeated digit
In this blog, we will learn to solve a problem based on Dynamic Programming. We will discuss three approaches based on number theory, dynamic programming, and Combinatorics.
Total count of sorted numbers up to N digits in the range [L, R]
This blog will cover the question to find the count of the total sorted numbers of up to N digits in the range [L, R].
Count of N-digit Numbers whose bitwise AND Of Adjacent Digits Equals 0 HARD
This article discusses the problem of counting N-digit numbers whose bitwise AND of adjacent digits equals 0.
Count of N Digit Numbers having each Digit as the Mean of its Adjacent Digits HARD
In this article, we will find the count of N digit numbers having each digit as the mean of its adjacent digits.
Count All Possible N-digit Numbers Such that Each Digit Does Not Appear More Than the Given Number of Times Consecutively
In this blog, we will learn to solve a problem count of all possible N-digit numbers such that each digit does not appear more than the given number of times consecutively.
Nth Number EASY
In this blog, we will discuss one of the famous questions that are regularly asked in technical interviews, i.e., Nth Number.
Author
0 upvotes
Classy Numbers HARD
In this blog, we will discuss the solution to the renowned problem of “classy numbers.
Longest Bitonic Subsequence
This article discusses the approach to finding the longest bitonic subsequence with complete explanation and its implementation in C++.
Author Spider
2 upvotes
Maximise Difference Between Sum Of Even And Odd-Indexed Elements Of A Subsequence
This article discusses the Problem, Maximise Difference Between Sum Of Even And Odd-Indexed Elements Of A Subsequence.
Maximum sum subsequence of any size that is decreasing-increasing alternatively
This article will brief you on the problem of finding the maximum sum subsequence of any size that is decreasing-increasing alternatively.
Maximum sum subsequence of any size which is decreasing-increasing alternatively HARD
This article will discuss the find maximum sum subsequence of any size which is the decreasing-increasing alternative problem and approach to solve this problem.
Count of valid arrays of size P with elements in the range [1, N] having duplicates at least M distance apart
In this blog, we will take up a coding problem based on dynamic programming. We will see how to efficiently implement a recursive solution using memoization.
Check if a path exists from start to end cell in given Matrix with obstacles in at most K moves
In this article, we will try to solve a graph theory problem that can be asked in the interviews
Longest subsequence such that the difference between adjacent elements is K
In this article, we will discuss the problem find the longest subsequence such that the difference between adjacent elements is K.
Inclusion-Exclusion Principle
In this blog, we will cover the Inclusion-Exclusion Principle and its applications.
Basic Geometry Knowledge EASY
This article will discuss a step-by-step walk-through of basic geometry knowledge, including lines, angles, triangles, and circles.
Convex Hull (Jarvis’s Algorithm) HARD
In this blog, we will learn how to compute the convex hull of a given set of points using Jarvis’s algorithm.
Convex Hull Problem using Divide and Conquer Algorithm HARD
The following blog discusses the Convex Hull problem along with some of the approaches to solve it focusing mainly on the Divide and Conquer Algorithm based approach.
Check if Two Line Segments Intersect MEDIUM
In this article, we will learn to check if two line segments intersect.
Find Maximum Perimeter of Quadrilateral Formed by Choosing Sides from Given Array.
In this blog, we will learn to solve the implementation-based problem, i.e., maximize the perimeter of the quadrilateral.
Count Number of Intersection Points for Given Lines Between (i, 0) and (j, 1)
The task is to find the point of intersections of the given N lines.
Finding the number of triangles amongst horizontal and vertical line segments
The blog aims to find the number of triangles amongst horizontal and vertical line segments.
Average Value of Set Bit Count in Given Binary String after Performing All Possible Choices of M Operations
In this article, we will solve a problem using the basic concept of probability which can be asked in the interviews or coding round of MAANG.
Find two Integers whose GCD is A, and the Difference Between their Squares is B
In this article, we will design an algorithm to find two integers X, Y whose GCD is a given number A, and the difference between their squares is also provided.
Cycle and cord
The objective of the problem is to find the number of ways in which we can divide a circle using a given number of chords such that no two chords intersect each other or non-intersecting chords.
Count of Distinct Integers Belonging to First ‘N’ Terms of at least one of Given Geometric Progression Series(GPs)
In this blog, we will learn to solve a problem based on number series. We will discuss an efficient approach to solve the problem.
Connect Chords HARD
This blog will cover the question Connect Chords and discuss its Time and Space complexity.
Length Of All Prefixes That Are Also The Suffixes Of The Given String
This article discusses the problem of finding the length of all prefixes that are also the suffixes of the string given.
Online Election MEDIUM
In this blog, we will discuss the problem of finding out the persons leading in the election and the implementation in Java
Longest Substring Without Repeating Characters
This article covers the different approaches and Implementations in C++ for the Longest Substring Without Repeating Characters.
Author Spider
0 upvotes
Stone Game VI
In this blog, we’ll see how to solve the famous problem of Stone Game VI by brute force, sorting, and multimap.
Winner of Tic-Tac-Toe EASY
The blog discusses in detail the ”Winner of Tic-tac-toe” problem. We’ll discuss the approach to solve the problem along with its time and space complexity.
KMP String Matching Algorithm EASY
The blog aims to help find all the occurrences of search string in a target string using the KMP algorithm.
Naive String Matching Algorithm HARD
This article describes the naive solution to the pattern matching problem.
Z Algorithm EASY
In this blog, we will discuss the Z Algorithm.
The number of times array B appears as a subarray in A
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.
Inappropriate Words Filter
This article discusses the problem of filtering inappropriate words
Decode Morse Code
This article discusses the problem of decoding the morse code
Prefix-Suffix Palindrome EASY
In this article, we will solve one of the popular problems, Prefix-Suffix Palindrome using Manacher's Algorithm.
Password Substring
This article discusses the problem of Substring Password
Equal substrings
This article will discuss the approach to finding the number of ways to select exactly ‘query[i]’ equal substrings from the given string. We will see how we can efficiently solve it using the Z-algorithm.
Count all substrings of all lengths that match exactly with the prefix and suffix of a string
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.
Longest Palindromic Substring For Every Center
In this article, we will learn how to find the length of the longest palindromic substring for every possible center. We will also focus on the complexity of our solution.
Substring Queries
This article will discuss the problem "Substring Queries," solution approach to the problem, its C++ implementation, and its time and space complexities.
Author Riya
1 upvote
x-Prime Substring
This article explains the methods for solving the problem of the x-prime substring.