# Category Archives: Algorithms (adsbygoogle = window.adsbygoogle || []).push({});

## Repeated Character Whose First Appearance is Leftmost

Given a string, find the repeated character present first in the string. Examples: Input : geeksforgeeks Output : g (mind that it will be g,… Read More »

## Find the root of the sub-tree whose weighted sum is minimum

Given a tree, and the weights of all the nodes, the task is to find the root of the sub-tree whose weighted sum is minimum.… Read More »

## Generate all unique partitions of an integer | Set 2

Given a positive integer n, the task is to generate all possible unique ways to represent n as sum of positive integers. Examples: Input: 4… Read More »

## Minimum number of pairs required to make two strings same

Given two strings s1 and s2 of same length, the task is to count the minimum number of pairs of characters (c1, c2) such that… Read More »

## Queries for bitwise OR in the given matrix

Given an N * N matrix mat[][] consisting of non-negative integers and some queries consisting of top-left and bottom-right corner of the sub-matrix, the task… Read More »

## Find the root of the sub-tree whose weighted sum XOR with X is maximum

Given a tree, and the weights of all the nodes, the task is to find the root of the sub-tree whose weighted sum XOR with… Read More »

## Find average of two numbers using bit operation

Given two integers x and y, the task is to find the average of these numbers i.e. (x + y) / 2 using bit operations.… Read More »

## Find if nCr is divisible by the given prime

Given three integers N, R and P where P is prime, the task is to find whether NCR is divisible by P or not. Examples:… Read More »

## Find the root of the sub-tree whose weighted sum XOR with X is minimum

Given a tree, and the weights of all the nodes, the task is to find the root of the sub-tree whose weighted sum XOR with… Read More »

## Queries for bitwise AND in the given matrix

Given an N * N matrix mat[][] consisting of non-negative integers and some queries consisting of top-left and bottom-right corner of the sub-matrix, the task… Read More »

## Queries for bitwise AND in the index range [L, R] of the given array

Given an array arr[] of N and Q queries consisting of a range [L, R]. the task is to find the bit-wise AND of all… Read More »

## Find number from its divisors

Given an array arr[] of N integers. The integers represent all the divisors of a number X except 1 and X itself. The task is… Read More »

## Queries for bitwise OR in the index range [L, R] of the given array

Given an array arr[] of N and Q queries consisting of a range [L, R]. the task is to find the bit-wise OR of all… Read More »

## Count the nodes in the given tree whose weight is even

Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose weight is even. Examples: Input:… Read More »

## Minimum steps required to reach the end of a matrix | Set 2

Given a 2d-matrix mat[][] consisting of positive integers, the task is to find the minimum number of steps required to reach the end of the… Read More »