## Replace all non-overlapping occurrences of the pattern

Given a C-style string and a pattern, in-place replace all non-overlapping occurrences of the pattern in the string by a specified character.

Coding made easy

Given a C-style string and a pattern, in-place replace all non-overlapping occurrences of the pattern in the string by a specified character.

Given an unsorted array of integers containing many duplicates elements, rearrange the given array such that same element appears together and relative order of first occurrence of each element remains unchanged.

In this post we will discuss few related problems that can be solved without using multiplication and division operators.

Given a binary tree, count all subtrees in it such that every node in the subtree have same value.

Given two integers, find minimum difference between their index in a given array in linear time and single traversal of the array.

Given a BST, find inorder successor of a given key in it. If the given key do not lie in the BST, then return the next greater key (if any) present in the BST.

Given an array, find the maximum absolute difference between sum of elements of two non-overlapping sub-arrays in linear time.

Given a directed weighted graph, report a negative-weight cycle in the graph if any. A negative-weight cycle is a cycle in graph whose edges sum to a negative value.

Given an array of pairs of integers, find all symmetric pairs i.e. pairs that are mirror of each other. For instance, pairs (x, y) and (y, x) are mirrors of each other.

Write a efficient algorithm to construct the longest palindrome by shuffling or deleting characters from a given string.

Given an array of integers, partition the array into two sub-arrays having the same sum of elements.

Given an array and an integer k, find the count of distinct elements in every sub-array of size k in the array.