Miscellaneous

Explore detailed explanations as well as the implementation of various topics in Competitive Programming. These topics are important in interview preparations. Try to implement them yourself before moving on to the solutions.

Trie

Trie has the following properties for a set of strings:
1. The root node always represents the null node.
2. Every node's child is arranged alphabetically.
3. Each node can have a maximum of 26 children (A to Z).
4. Except for the root, each node can store one letter of the alphabet.

Longest Common Prefix Matching

By saksham

● Published At Oct 2021

In this blog, we will learn how we can solve an all-time classic interview problem, “Longest common prefix matching”, using a very interesting data structure, i.e., Tries.... Keep reading ..

Pattern Searching using a Trie of all Suffixes

By Malay Gain

● Published At Jan 2022

In this article, we will learn how to implement pattern Searching using a Trie of all Suffixes.... Keep reading ..

Implement a Dictionary using Trie

By dhruv sharma

● Published At Dec 2021

This article will cover the approach and the implementation of building a dictionary of words with their meanings using Trie.... Keep reading ..

Longest Common Prefix Using Trie

By Riya

● Published At Feb 2022

This article will discuss how to find the longest common prefix using trie, its C++ implementation, and its time and space complexity.... Keep reading ..

Container With Most Water

By Harsh Goyal

● Published At Nov 2021

This article will discuss the container with the most water problem and various ways to solve this problem, starting from the brute force approach to the efficient approach.... Keep reading ..

Aho-corasick Algorithm

By Manan Singhal

● Published At May 2022

This article discusses the Aho-Corasick Algorithm, one of the most famous string pattern matching algorithms.... Keep reading ..

Computational Geometry

Computational geometry is a branch of computer science devoted to the study of algorithms that can be stated in terms of geometry. Some purely geometrical problems arise out of it.
Computational complexity is central to computational geometry, with great practical significance if algorithms are used on very large datasets containing tens or hundreds of millions of points.

Inclusion-Exclusion Principle

By Nishant Rana

● Published At Oct 2021

In this blog, we will cover the Inclusion-Exclusion Principle and its applications.
... Keep reading ..

Solving The Convex Hull Problem using Divide and Conquer Algorithm

By Akshat Chaturvedi

● Published At Oct 2021

In this blog, we’ll discuss the convex hull problem and solve it using the Divide and Conquer algorithm.
... Keep reading ..

Check if two line segments intersect

By Malay Gain

● Published At Oct 2021

In this article, we will learn to check if two line segments intersect.
... Keep reading ..

Find Maximum Perimeter of Quadrilateral Formed by Choosing Sides from Given Array.

By Ujjawal Gupta

● Published At Jan 2022

In this blog, we will learn to solve the implementation-based problem, i.e., maximize the perimeter of the quadrilateral.... Keep reading ..

Count Number of Intersection Points for Given Lines Between (i, 0) and (j, 1)

By Sujal Modanwal

● Published At Jan 2022

The task is to find the point of intersections of the given N lines. ... Keep reading ..

Finding the number of triangles amongst horizontal and vertical line segments

By HET FADIA

● Published At Jan 2022

The blog aims to find the number of triangles amongst horizontal and vertical line segments.... Keep reading ..

Average Value of Set Bit Count in Given Binary String after Performing All Possible Choices of M Operations

By Abhishek Ranjan

● Published At Jan 2022

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.... Keep reading ..

Find two Integers whose GCD is A, and the Difference Between their Squares is B

By GAZAL ARORA

● Published At Mar 2022

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.
... Keep reading ..

Cycle and cord

By Arun Nawani

● Published At Oct 2021

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. ... Keep reading ..

Count of Distinct Integers Belonging to First ‘N’ Terms of at least one of Given Geometric Progression Series(GPs)

By Ujjawal Gupta

● Published At Jan 2022

In this blog, we will learn to solve a problem based on number series. We will discuss an efficient approach to solve the problem.
... Keep reading ..

Minimize value of |A – X| + |B – Y| + |C – Z| such that X * Y = Z

By Shreya Deep

● Published At Jan 2022

This article describes the method to find the minimum value of the expression |A-X|+|B-Y|+|C-Z|, provided X*Y=Z.... Keep reading ..

Basic Geometry Knowledge

By Urwashi Priya

● Published At Oct 2021

This article will discuss a step-by-step walk-through of basic geometry knowledge, including lines, angles, triangles, and circles.
... Keep reading ..

Convex Hull (Jarvis’s Algorithm)

By Yogesh Kumar

● Published At Oct 2021

In this blog, we learn about the concept of Convex Hull in which Jarvis’s Algorithm helps us implement the idea of the Convex Hull.... Keep reading ..

Check If a Point Lies In The Interior of a Polygon

By Malay Gain

● Published At Oct 2021

In this article, we will learn to check if a point lies in the interior of a polygon
... Keep reading ..

Connect Chords

By Nishant Rana

● Published At Feb 2022

This blog will cover the question Connect Chords and discuss its Time and Space complexity.
... Keep reading ..

Disjoint Set

In computer science, a disjoint-set data structure is also called a union-find data structure or merge–find set. It is a data structure that stores a collection of disjoint (non-overlapping) sets. Equivalently, it stores a partition of a set into disjoint subsets. It provides operations for adding new sets, merging sets (replacing them by their union), and finding a representative member of a set. The last operation allows to find out efficiently if any two elements are in the same or different sets.
In simple words, a Disjoint Set means dividing the individuals into different sets according to the groups in which they fall and each set is represented by one of its members.

Disjoint Set Unions - Union Find Algorithm

By Aanchal Tiwari

● Published At Nov 2021

The choice of an efficient algorithm reduces time complexity. Today’s article discusses one such algorithm - Union find algorithm.
... Keep reading ..

Permutation Swaps

By Nishant Rana

● Published At Jan 2022

This blog will cover the question of Permutation swaps and discuss their Time and Space complexity.
... Keep reading ..

The Earliest Moment When Everyone Becomes Friends

By Soumya Agrawal

● Published At Jan 2022

This article will cover the widespread problem of the Disjoint-set, i.e., The earliest moment when everyone becomes friends.... Keep reading ..

Count of Distinct Groups of Strings Formed after Performing an Equivalent Operation

By Soumya Agrawal

● Published At Jan 2022

This article will cover the concept of string and the problem of counting the distinct string group after performing an operation.... Keep reading ..

Minimum Cost to connect the graph by choosing any vertices that have a cost of at least 0

By Vaibhav Agarwal

● Published At Jan 2022

In this article, we will discuss the approach to connect the graph in minimum cost, in which cost for connecting each vertex is given to us.... Keep reading ..

Maximum sum of segments among all segments formed in array after Q queries

By Anant Dhakad

● Published At Jan 2022

The choice of an efficient algorithm reduces time complexity. This article discusses a problem based on one such article, the Union-Find algorithm.... Keep reading ..

Game Theory

Game Theory is a topic in competitive programming that usually comes in contests with a mixture of other topics like greedy, dynamic programming, etc. It might be confusing in the initial stages, but practicing a lot of problems in game theory will help you master it.
Game theory is a concept that helps us predict the result of a game without playing the game. In this process, generally, two players are playing the game, and we have to predict as fast as possible which player will win by applying some math behind it.
Game Theory is basically thinking about some hidden observation. Something is hidden for which we have to sharpen our minds and think. Once we understand the math, then we'll find it easy to solve problems in game theory.
This category contains all of the concepts you need to know about game theory.

Count The Number Of Players Who Need Training And Have Strictly Less Power And Endurance Than Any Other Player

By Rhythm Jain

● Published At Dec 2021

In this article, we will discuss the problem of Counting the number Of Players Who Need Training And Have Strictly Less Power And Endurance Than Any Other Player.... Keep reading ..

Predict the winner of a game by converting 0 to 1 turn by turn following the given rules

By Yukti Kumari

● Published At Jan 2022

This article explains the problem to predict the winner of a game by converting 0 to 1 turn by turn following the given rules
... Keep reading ..

Game of Nim

By Rhythm Jain

● Published At Oct 2021

This article discusses the problem of Game of Nim, which is one of the most important questions in competitive programming... Keep reading ..

Stone Game

By Rhythm Jain

● Published At Oct 2021

In this article, we will discuss the problem of Stone Game that covers dynamic programming, game theory, and mathematics concepts involved.... Keep reading ..

Stone Game 2

By Rhythm Jain

● Published At Oct 2021

This article discusses the Problem of Stone Games 2, which is one of the most famous questions in dynamic programming and game theory.... Keep reading ..

Stone Game III

By Yogesh Kumar

● Published At Oct 2021

This blog will solve a LeetCode Problem named Stone Game III in a Brute Force manner to an Optimized Approach.
... Keep reading ..

Stone Game IV

By Yogesh Kumar

● Published At Nov 2021

This blog will solve a LeetCode Problem named Stone Game IV in a Brute Force manner to an Optimized Approach.
... Keep reading ..

Stone Game VII

By Aman kumar Chourasiya

● Published At Jan 2022

This blog will discuss the famous Leetcode problem Stone Game VII and solve it using dynamic programming.... Keep reading ..

The Prisoner’s Dilemma Game Theory

By Arun Nawani

● Published At Oct 2021

The prisoner’s dilemma game theory is a classic decision-making problem, very much prevalent in real-life scenarios as well.
... Keep reading ..

The Alpha-Beta Pruning Algorithm

By Akshat Chaturvedi

● Published At Oct 2021

In this blog post, we’ll study the alpha-beta pruning algorithm and explore an example for a clear understanding.... Keep reading ..

The Divisor Game

By Arun Nawani

● Published At Oct 2021

Two friends are playing a divisor game where every time a number is reduced by one of its factors. A player loses if they can’t reduce the number any further. Our task is to know which one of the friends will win the game.
... Keep reading ..

MinMax Algorithm

By Firdausia Fatima

● Published At Dec 2021

In this blog, we’ll explore the famous MinMax Algorithm.... Keep reading ..

Sprague Grundy Theorem

By Yukti Kumari

● Published At Nov 2021

This article explains the Sprague Grundy theorem with examples in game theory.
... Keep reading ..

Miscellaneous Problems

In competitive programming contests, various miscellaneous problems involving the concept of Trie, Computational Geometry, Game Theory, etc., are asked. These questions might be challenging for beginners, but one can easily ace this with regular practice and effort. Participating in contests will also be helpful to master these miscellaneous problems.
This category contains all of the information you need to know to solve miscellaneous problems.

Find MEX of every subtree in the given Tree

By Vibhor Bhatnagar

● Published At Dec 2021

This article will discuss the problem to find MEX of every subtree in the given tree.
... Keep reading ..

Bitwise AND of Numbers Range

By Ishita Chawla

● Published At Dec 2021

This blog will discuss the different ways to solve the problem of bitwise AND of Numbers Range, subsequently discussing the time and space complexity.
... Keep reading ..

Maximum AND value of a pair in an array

By Nishant Rana

● Published At Feb 2022

This blog will cover the question of finding the maximum bitwise AND value of a pair in an array and discuss its Time and Space complexities.
... Keep reading ..

Maximum XOR value pair

By Riya

● Published At Feb 2022

This article will discuss the “maximum XOR value pair” problem in which we have to find the maximum possible XOR value pair present in the given array Arr of non-negative integers of size N. ... Keep reading ..

Find the leftmost and rightmost set bit of a number

By Raksha jain

● Published At Feb 2022

The blog discusses in detail the ”Find the leftmost and rightmost set bit of a number” problem. We’ll discuss many approaches to solve the problem and time and space complexity for each method.... Keep reading ..

Find the element that appears once

By Nishant Rana

● Published At Feb 2022

This blog will cover the question of Finding the element that appears once and discuss their Time and Space complexity.... Keep reading ..

## Top Problems related to Miscellaneous

Implement Trie

Find Slope

Area Under Curve

Connect MidPoints

Max Game

Common Elements

Total area of overlapping rectangles

Maximum XOR

Check If Given Words Are Present In A String

Count Distinct Substrings

Group Anagrams Together

Missing Vertex In Parallelogram

Number of GP sequence

Trie Implementation

Check Square

Trie Delete Operation

Implement a phone directory

Maximum Points On Straight Line

Word Search - lll

Word Ladder

Number In AP