## Minimum cost to colour a Tree with no 3 adjacent vertices having same colour

Given a tree with N nodes value from 0 to (N – 1) and a 2D array arr[][] of size dimensions 3xN, where arr[i][j] denotes… Read More »

- Minimize the maximum difference between adjacent elements in an array
- Maximum sum path in a Matrix
- Stack of Pair in C++ STL with Examples
- Set of Vectors in C++ STL with Examples
- Queue of Pairs in C++ STL with Examples
- Find the K closest points to origin using Priority Queue
- Convert Adjacency Matrix to Adjacency List representation of Graph
- Count of subarrays which start and end with the same element
- Real-time application of Data Structures
- Find the string formed by joining k consecutive nodes of linked list
- Kth most frequent Character in a given String
- Program to reverse words in a given string in C++
- Implementing upper_bound() and lower_bound() for Ordered Set in C++
- Longest Mountain Subarray
- What is a Webcrawler and where is it used?
- Count the number of ways to construct the target string
- Reverse an array in groups of given size | Set 3 (Single traversal)
- Count triplets such that sum of any two number is equal to third | Set 2
- Why Prim’s and Kruskal's MST algorithm fails for Directed Graph?
- CamelCase Pattern Matching
- Program to find frequency of each element in a vector using map in C++
- Count ways to partition a string such that both parts have equal distinct characters
- Find if there is a path between two vertices in an undirected graph
- Design a Queue data structure to get minimum or maximum in O(1) time
- Paranthesis Theorem
- Shortest path in a directed graph by Dijkstra’s algorithm
- Duplicates Removal in Array using BST
- Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
- XOR of elements in a given range with updates using Fenwick Tree
- Maximum Possible Rating of a Coding Contest

Given a tree with N nodes value from 0 to (N – 1) and a 2D array arr[][] of size dimensions 3xN, where arr[i][j] denotes… Read More »

Given a binary string str, the task is to build a DFA that accepts the string if the string either starts with “01” or ends… Read More »

Given a Tree with N vertices and N – 1 edges where the vertices are numbered from 0 to N – 1, and a vertex… Read More »

Given an array arr[] of size N, the task is to find the minimum number of elements that need to be inserted into the array… Read More »

Given an array arr[] containing N non-negative integers, the task is to sort these integers according to the sum of the number of letters required… Read More »

Given a string str, the task is to check whether the given string is valid MAC address or not by using Regular Expression. A valid… Read More »

Given a string str, the task is to check whether the given string is valid GUID (Globally Unique Identifier) or not by using Regular Expression.… Read More »

Given two integers N and K where N denotes the height of a binary tree, the task is to find the parent of the node… Read More »

Given an array arr[] of size N which contains the permutations of the N natural numbers, the task is to sort the permutations of N… Read More »

Given an N-ary Tree containing N nodes, values associated with each node and Q queries, where each query contains a single node. The task is… Read More »

Given a binary string S of size N and an integer K. The task is to find the maximum number of set bit appears in… Read More »

Given an integer S and an array arr[], the task is to find the minimum number of elements whose sum is S, such that any… Read More »

Given two integer arrays arr[] and cost[] of size N, the task is to make all adjacent elements distinct at minimum cost. cost[i] denotes the… Read More »

Given two integer arrays a[] and b[], the task is to find the maximum possible product of the same indexed elements of two equal length… Read More »

Given a Binary Tree having positive and negative nodes, the task is to find the maximum absolute difference of level sum in it. Examples: Input:… Read More »