# Category Archives: Algorithms

## Find the minimum difference between Shifted tables of two numbers

Given two numbers ‘a’ and ‘b’. Find the minimum difference between any terms in shifted infinite tables of ‘a’ and ‘b’, given shifts ‘x’ and… Read More »

## Meet in the middle

Given a set of n integers where n <= 40. Each of them is at most 1012, determine the maximum sum subset having sum less… Read More »

## Sum of Fibonacci Numbers

Given a number positive number n, find value of f0 + f1 + f2 + …. + fn where fi indicates i’th Fibonacci number. Remember… Read More »

## Java Program for Bitonic Sort

Bitonic Sequence A sequence is called Bitonic if it is first increasing, then decreasing. In other words, an array arr[0..n-i] is Bitonic if there exists… Read More »

## C++ Program for Bitonic Sort

Bitonic Sequence A sequence is called Bitonic if it is first increasing, then decreasing. In other words, an array arr[0..n-i] is Bitonic if there exists… Read More »

## Bitonic Sort

Background Bitonic Sort is a classic parallel algorithm for sorting. Bitonic sort does O(n Log 2n) comparisons. The number of comparisons done by Bitonic sort… Read More »

## Job Sequencing Problem | Set 2 (Using Disjoint Set)

Given a set of n jobs where each job i has a deadline di >=1 and profit pi>=0. Only one job can be scheduled at… Read More »

## Combinatorial Game Theory | Set 4 (Sprague – Grundy Theorem)

Prerequisites : Grundy Numbers/Nimbers and Mex We have already seen in Set 2 (https://www.geeksforgeeks.org/combinatorial-game-theory-set-2-game-nim/), that we can find who wins in a game of Nim… Read More »

## Find the Largest number with given number of digits and sum of digits

How to find the largest number with given digit sum s and number of digits d? Examples: Input : s = 9, d = 2… Read More »

## Combinatorial Game Theory | Set 3 (Grundy Numbers/Nimbers and Mex)

We have introduced Combinatorial Game Theory in Set 1 and discussed Game of Nim in Set 2. Grundy Number is a number that defines a… Read More »

## Find smallest number with given number of digits and sum of digits

How to find the smallest number with given digit sum s and number of digits d? Examples : Input : s = 9, d =… Read More »

## Find if string is K-Palindrome or not | Set 1

Given a string, find out if the string is K-Palindrome or not. A k-palindrome string transforms into a palindrome on removing at most k characters… Read More »

## Adobe Interview Experience | Set 36 (Off-Campus Drive)

Online Written Test: Multiple choice questions on aptitude and programming 2 coding questions. F2F R1 1) Given a string of any length. print all possible… Read More »

## C qsort() vs C++ sort()

Standard C library provides qsort function that can be used for sorting an array. Following is the prototype of qsort() function. // Sort an array… Read More »

## Find maximum length Snake sequence

Given a grid of numbers, find maximum length Snake sequence and print it. If multiple snake sequences exists with the maximum length, print any one… Read More »