- Reverse elements of a Parallel Stream in Java
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- Java | ==, equals(), compareTo(), equalsIgnoreCase() and compare()
- C# | Array vs ArrayList
- Sum of all odd length palindromic numbers within the range [L, R]
- 10 Ways to Create a Stream in Java
- Move all special char to the end of the String
- Move all Uppercase char to the end of string
- ArrayList iterator() method in Java with Examples
- Check if the given decimal number has 0 and 1 digits only
- Check if a value is present in an Array in Java
- Count rows in a matrix that consist of same element
- Scala | Nested Functions
- Command Line Argument in Scala
- How to remove all non-printable characters in a string in PHP?
- How to trim all strings in an array in PHP ?
- Delete all even elements from a stack
- Find the last non repeating character in string
- Queries to find the last non-repeating character in the sub-string of a given string
- Check if the two given stacks are same
- Program to calculate angle on circumference subtended by the chord when the central angle subtended by the chord is given
- Area of a Regular Pentagram
- Count pairs of elements such that number of set bits in their OR is B[i]
- Program to calculate area of inner circle which passes through center of outer circle and touches its circumference

- Remove duplicates from a given string
- Given only a pointer/reference to a node to be deleted in a singly linked list, how do you delete it?
- Detect loop in a linked list
- Write a Program to Find the Maximum Depth or Height of a Tree
- Convert a Binary Tree into its Mirror Tree
- Write a function to get the intersection point of two Linked Lists
- Given a linked list which is sorted, how will you insert in sorted way
- Compute the minimum or maximum of two integers without branching
- A program to check if a binary tree is BST or not
- Merge two sorted linked lists
- Queue using Stacks
- Remove duplicates from a sorted linked list
- Reverse a Doubly Linked List
- Maximum difference between two elements such that larger element appears after the smaller number
- Check for balanced parentheses in an expression
- Count of Binary Digit numbers smaller than N
- Delete alternate nodes of a Linked List
- Find the two repeating elements in a given array
- Reverse a Linked List in groups of given size | Set 1
- Evaluation order of operands
- Find duplicates in O(n) time and O(1) extra space | Set 1
- Program for Fibonacci numbers
- Print a given matrix in spiral form
- Sliding Window Maximum (Maximum of all subarrays of size k)
- Reverse alternate K nodes in a Singly Linked List
- Segregate even and odd nodes in a Linked List
- Detect and Remove Loop in a Linked List
- Find whether an array is subset of another array | Added Method 3
- Sudoku | Backtracking-7
- Smallest of three integers without comparison operators
- Check whether two strings are anagram of each other
- Find a triplet that sum to a given value
- K'th smallest element in BST using O(1) Extra Space
- Find the smallest positive number missing from an unsorted array | Set 1
- Find four elements that sum to a given value | Set 2 ( O(n^2Logn) Solution)
- Find the element that appears once
- Lexicographic rank of a string
- Given a sequence of words, print all anagrams together | Set 2
- Transitive closure of a graph
- Sort a linked list of 0s, 1s and 2s
- The Stock Span Problem
- Largest Independent Set Problem | DP-26
- Find multiplication of sums of data of leaves at same levels
- Tug of War
- QuickSort on Doubly Linked List
- Dice Throw | DP-30
- Swap Kth node from beginning with Kth node from end in a Linked List
- Iterative Method to find Height of Binary Tree
- Check for Identical BSTs without building the trees
- QuickSort on Singly Linked List
- Merge k sorted arrays | Set 1
- Difference between sums of odd level and even level nodes of a Binary Tree
- Check if all leaves are at same level
- Extract Leaves of a Binary Tree in a Doubly Linked List
- Find the first non-repeating character from a stream of characters
- Find next right node of a given key
- Find LCA in Binary Tree using RMQ
- Remove minimum elements from either side such that 2*min becomes more than max
- Search in a Row-wise and Column-wise Sorted 2D Array using Divide and Conquer algorithm
- Program for nth Catalan Number
- Boolean Parenthesization Problem | DP-37
- Channel Assignment Problem
- Find next greater number with same set of digits
- Shortest path with exactly k edges in a directed and weighted graph
- Pattern Searching using a Trie of all Suffixes
- Mobile Numeric Keypad Problem
- Snake and Ladder Problem
- Convert a Binary Tree to Threaded binary tree | Set 1 (Using Queue)
- Multiply two polynomials
- K'th Smallest/Largest Element in Unsorted Array | Set 1
- K'th Smallest/Largest Element in Unsorted Array | Set 2 (Expected Linear Time)
- K'th Smallest/Largest Element in Unsorted Array | Set 2 (Expected Linear Time)
- K'th Smallest/Largest Element in Unsorted Array | Set 3 (Worst Case Linear Time)
- Flood fill Algorithm - how to implement fill() in paint?
- Check if a given array contains duplicate elements within k distance from each other
- Find a common element in all rows of a given row-wise sorted matrix
- Rearrange an array such that 'arr[j]' becomes 'i' if 'arr[i]' is 'j' | Set 1
- Find number of days between two given dates
- Find the longest substring with k unique characters in a given string
- Swap nodes in a linked list without swapping data
- Merge Sort for Doubly Linked List
- Select a Random Node from a Singly Linked List
- Sort an almost sorted array where only two elements are swapped
- Remove spaces from a given string
- Count total number of N digit numbers such that the difference between sum of even and odd digits is 1
- Print string of odd length in 'X' format
- Find the largest rectangle of 1's with swapping of columns allowed
- Find all possible outcomes of a given expression
- Maximum weight transformation of a given string
- Given an array of pairs, find all symmetric pairs in it
- Longest Repeating Subsequence
- How to check if a given array represents a Binary Heap?
- Find minimum possible size of array with given rules for removing elements
- Find Minimum Depth of a Binary Tree
- Range Minimum Query (Square Root Decomposition and Sparse Table)
- Print all Jumping Numbers smaller than or equal to a given value
- Reorder an array according to given indexes
- Combinatorial Game Theory | Set 3 (Grundy Numbers/Nimbers and Mex)
- Merge two sorted linked lists such that merged list is in reverse order
- Print individual digits as words without using if or switch
- Merge two sorted arrays with O(1) extra space
- Count Integral points inside a Triangle
- Form minimum number from given sequence
- How to avoid overflow in modular multiplication?
- 1's and 2's complement of a Binary Number
- Check whether given degrees of vertices represent a Graph or Tree
- Bin Packing Problem (Minimize number of used Bins)
- Count numbers having 0 as a digit
- Printing Paths in Dijkstra's Shortest Path Algorithm
- Querying maximum number of divisors that a number in a given range has
- Construct Ancestor Matrix from a Given Binary Tree
- Point arbit pointer to greatest value right side node in a linked list
- Non-recursive program to delete an entire binary tree
- GCDs of given index ranges in an array
- Common elements in all rows of a given matrix
- Sort linked list which is already sorted on absolute values
- Rearrange array in alternating positive & negative items with O(1) extra space | Set 2
- Printing Shortest Common Supersequence
- Maximum product of a triplet (subsequnece of size 3) in array
- Find maximum length Snake sequence
- Find smallest range containing elements from k lists
- Find if string is K-Palindrome or not | Set 1
- Delete middle of linked list
- Check if a linked list is Circular Linked List
- Longest Common Prefix using Word by Word Matching
- Find frequency of each element in a limited range array in less than O(n) time
- Number of ways to calculate a target number using only array elements
- Rearrange a string so that all same characters become atleast d distance away
- How to find Lexicographically previous permutation?
- Longest Common Prefix using Divide and Conquer Algorithm
- Maximum value K such that array has at-least K elements that are >= K
- Lower case to upper case - An interesting fact
- Find even occurring elements in an array of limited range
- Heap's Algorithm for generating permutations
- Printing Longest Common Subsequence | Set 2 (Printing All)
- Program to convert a given number to words | Set 2
- Rearrange positive and negative numbers with constant extra space
- Range LCM Queries
- Generate 0 and 1 with 25% and 75% probability
- Sub-string Divisibility by 3 Queries
- Find longest palindrome formed by removing or shuffling chars from string
- Longest Geometric Progression
- Find all strings that match specific pattern in a dictionary
- Find height of a special binary tree whose leaf nodes are connected
- Reverse an array in groups of given size | Set 2 (Variations of Set 1 )
- Find if an expression has duplicate parenthesis or not
- Third largest element in an array of distinct elements
- Subtract Two Numbers represented as Linked Lists
- A Space Optimized DP solution for 0-1 Knapsack Problem
- Find Two Missing Numbers | Set 1 (An Interesting Linear Time Solution)
- Count digit groupings of a number with given constraints
- Count Distinct Subsequences
- Find minimum elements after considering all possible transformations
- Maximum Consecutive Increasing Path Length in Binary Tree
- Pairs of complete strings in two sets of strings
- Frequency Measuring Techniques for Competitive Programming
- Count and Toggle Queries on a Binary Array
- Vigenère Cipher
- Remove Invalid Parentheses
- Longest common subsequence with permutations allowed
- Longest consecutive sequence in Binary tree
- Check if a string has all characters with same frequency with one variation allowed
- Check if a string can become empty by recursively deleting a given sub-string
- Remove minimum number of characters so that two strings become anagram
- XOR Cipher
- Count all pairs with given XOR
- Find pairs with given sum in doubly linked list
- Find maximum difference between nearest left and right smaller elements
- Sort a string according to the order defined by another string
- Distinct strings with odd and even changes allowed
- Sum of maximum elements of all subsets
- Find Maximum Sum Strictly Increasing Subarray
- Count characters at same position as in English alphabet
- Minimum Product Spanning Tree
- Maximum subsequence sum such that no three are consecutive
- Maximum sum of nodes in Binary tree such that no two are adjacent
- Find all sides of a right angled triangle from given hypotenuse and area | Set 1
- Count pairs whose products exist in array
- Count minimum number of "move-to-front" moves to sort an array
- Minimum characters to be added at front to make string palindrome
- Print all nodes in a binary tree having K leaves
- Minimum difference between adjacent elements of array which contain elements from each row of a matrix
- Maximum 0's between two immediate 1's in binary representation
- Find all permuted rows of a given row in a matrix
- Sort even-placed elements in increasing and odd-placed in decreasing order
- Find the first natural number whose factorial is divisible by x
- Sort an array when two halves are sorted
- Program to toggle all characters in a string
- Minimum number of elements which are not part of Increasing or decreasing subsequence in array
- LCS (Longest Common Subsequence) of three strings
- Check linked list with a loop is palindrome or not
- Find Maximum dot product of two arrays with insertion of 0's
- Rearrange an array to minimize sum of product of consecutive pair elements
- Find pairs in array whose sums already exist in array
- K-th smallest element after removing some integers from natural numbers
- Sqrt (or Square Root) Decomposition Technique | Set 1 (Introduction)
- Break an array into maximum number of sub-arrays such that their averages are same
- Find three element from different three arrays such that a + b + c = sum
- Queries on substring palindrome formation
- Count of index pairs with equal elements in an array
- Boggle | Set 2 (Using Trie)
- Maximum difference between frequency of two elements such that element having greater frequency is also greater
- Friends Pairing Problem
- Printing all solutions in N-Queen Problem
- Count binary strings with k times appearing adjacent two set bits
- Program for FCFS CPU Scheduling | Set 1
- Check if reversing a sub array make the array sorted
- Minimum operations required to remove an array
- Find all triplets with zero sum
- Number of subsequences in a string divisible by n
- Print consecutive characters together in a line
- Pizza cut problem (Or Circle Division by Lines)
- Check if a Binary Tree contains duplicate subtrees of size 2 or more
- Program for Worst Fit algorithm in Memory Management
- Number with maximum number of prime factors
- Nearest element with at-least one common prime factor
- Type of array and its maximum element
- Sort array after converting elements to their squares
- Sort all even numbers in ascending order and then sort all odd numbers in descending order
- Find N'th item in a set formed by sum of two arrays
- Program for Banker's Algorithm | Set 1 (Safety Algorithm)
- Make largest palindrome by changing at most K-digits
- Word formation using concatenation of two dictionary words
- Find largest word in dictionary by deleting some characters of given string
- Largest divisible subset in array
- Count of strings that can be formed using a, b and c under given constraints
- Maximum edge removal from tree to make even forest
- Find the missing number in a string of numbers with no separator
- Count substrings with same first and last characters
- Find the Deepest Node in a Binary Tree
- Print all full nodes in a Binary Tree
- Convert decimal fraction to binary number
- Find sum of non-repeating (distinct) elements in an array
- Number of pair of positions in matrix which are not accessible
- Find the largest multiple of 3 from array of digits | Set 2 (In O(n) time and O(1) space)
- Move all occurrences of an element to end in a linked list
- Deletion from a Circular Linked List
- Iterative program to count leaf nodes in a Binary Tree
- Finding LCM of more than two (or array) numbers without using GCD
- Prufer Code to Tree Creation
- Count the number of subarrays having a given XOR
- Find the next identical calendar year
- Nth Square free number
- Binary Search Tree insert with Parent Pointer
- Doubly Circular Linked List | Set 2 (Deletion)
- Smallest length string with repeated replacement of two distinct adjacent
- Find first non matching leaves in two binary trees
- Largest subset of Graph vertices with edges of 2 or more colors
- Count of arrays in which all adjacent elements are such that one of them divide the another
- Number of sink nodes in a graph
- How to implement decrease key or change key in Binary Search Tree?
- Lexicographically minimum string rotation | Set 1
- Generate all binary permutations such that there are more or equal 1's than 0's before every point in all permutations
- Print All Distinct Elements of a given integer array
- Program to add two polynomials
- Connected Components in an undirected graph
- Greedy Algorithm to find Minimum number of Coins
- Remove recurring digits in a given number
- Check if a sorted array can be divided in pairs whose sum is k
- Print level order traversal line by line | Set 1
- Linked List | Set 1 (Introduction)
- Doubly Linked List | Set 1 (Introduction and Insertion)
- Find Length of a Linked List (Iterative and Recursive)
- Delete last occurrence of an item from linked list
- Stack | Set 3 (Reverse a string using stack)
- Number of subtrees having odd count of even numbers
- Minimum number of Appends needed to make a string palindrome
- Move spaces to front of string in single traversal
- Find distance from root to given node in a binary tree
- Count full nodes in a Binary tree (Iterative and Recursive)
- Count numbers whose sum with x is equal to XOR with x
- Binary representation of next greater number with same number of 1's and 0's
- TimSort
- Threaded Binary Search Tree | Deletion
- Reverse an array without using subtract sign ‘-‘ anywhere in the code
- First element occurring k times in an array
- K-th Element of Two Sorted Arrays
- Print array of strings in sorted order without copying one string into another
- Determine if a string has all Unique Characters
- Find index of an extra element present in one sorted array
- Shortest Uncommon Subsequence
- Averages of Levels in Binary Tree
- Find the n-th number made of even digits only
- Biggest number by arranging numbers in certain order
- Program to find Smallest and Largest Word in a String
- Program to remove vowels from a String
- Removing punctuations from a given string
- Minimum edge reversals to make a root
- Output of Java program | Set 22 (Overloading)
- Sum of divisors of factorial of a number
- First negative integer in every window of size k
- Sum of product of all pairs of array elements
- Check if two numbers are bit rotations of each other or not
- Iterative method to check if two trees are mirror of each other
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Check whether given string can be generated after concatenating given strings
- String containing first letter of every word in a given string with spaces
- Maximizing Unique Pairs from two arrays
- Find mirror of a given node in Binary tree
- Print the path common to the two paths from the root to the two given nodes
- Reverse vowels in a given string
- Find minimum value to assign all array elements so that array product becomes greater
- Count of only repeated element in a sorted array of consecutive elements
- Non-overlapping sum of two sets
- Boyer Moore Algorithm | Good Suffix heuristic
- Bubble sort using two Stacks
- Count pairs from two sorted arrays whose sum is equal to a given value x
- Find number of diagonals in n sided convex polygon
- Find Corners of Rectangle using mid points
- Length of the transverse common tangent between the two non intersecting circles
- Program to find line passing through 2 Points
- Check if a string is Isogram or not
- Multistage Graph (Shortest Path)
- Check if absolute difference of consecutive nodes is 1 in Linked List
- Find a pair of elements swapping which makes sum of two arrays same
- Check if an array represents Inorder of Binary Search tree or not
- Print all permutation of a string using ArrayList
- Find the sum of last n nodes of the given Linked List
- Sum of product of all elements of sub-arrays of size k
- Maximize matrix as per given condition
- Count pairs from two linked lists whose sum is equal to a given value
- Find the Sub-array with sum closest to 0
- Count quadruples from four sorted arrays whose sum is equal to a given value x
- Given a number as a string, find the number of contiguous subsequences which recursively add up to 9 | Set 2
- Largest number in BST which is less than or equal to N
- Find k-th bit in a binary string created by repeated invert and append operations
- Keyword Cipher
- Program for Shortest Job First (SJF) scheduling | Set 2 (Preemptive)
- Print the string after the specified character has occurred given no. of times
- Remove duplicates from a sorted doubly linked list
- Squareroot(n)-th node in a Linked List
- Print last k digits of a^b (a raised to power b)
- Shuffle 2n integers in format {a1, b1, a2, b2, a3, b3, ......, an, bn} without using extra space
- Null Cipher
- Print odd positioned nodes of odd levels in level order of the given binary tree
- Find an element in Bitonic array
- Iterative method to find ancestors of a given binary tree
- Minimum rotations required to get the same string
- Maximize a given unsigned number number by swapping bits at it's extreme positions.
- Convert all substrings of length 'k' from base 'b' to decimal
- Preorder Successor of a Node in Binary Tree
- Check if binary representation of a given number and its complement are anagram
- Longest Prime Subarray after removing one element
- Next greater element in same order as input
- Minimum Index Sum for Common Elements of Two Lists
- Calculate number of nodes between two vertices in an acyclic Graph by Disjoint Union method
- Counts Path in an Array
- Remove brackets from an algebraic string containing + and - operators
- Check if a large number can be divided into two or more segments of equal sum
- Remove minimum number of elements such that no common element exist in both array
- Find if an array contains a string with one mismatch
- Check whether right angled triangle is valid or not for large sides
- Adding elements of an array until every element becomes greater than or equal to k
- Sum of all even numbers in range L and R
- Count subarrays with equal number of occurrences of two given elements
- Merge two sorted lists (in-place)
- Sort first half in ascending and second half in descending order | 1
- Length of the smallest sub-string consisting of maximum distinct characters
- Remove three consecutive duplicates from string
- Sum and Product of Prime Frequencies of Characters in a String
- Generating distinct subsequences of a given string in lexicographic order
- Sum triangle from array
- Balance pans using given weights that are powers of a number
- Print the nodes at odd levels of a tree
- Check if a grid can become row-wise and column-wise sorted after adjacent swaps
- Best meeting point in 2D binary array
- Maximum number of unique prime factors
- Minimum number of Square Free Divisors
- Sort an array according to absolute difference with a given value "using constant extra space"
- Check if two unsorted arrays (with duplicates allowed) have same elements
- Count all triplets whose sum is equal to a perfect cube
- Pattern Printing question asked in CGI Coding Round
- Lexicographically smallest permutation of {1, .. n} such that no. and position do not match
- Count number of digits after decimal on dividing a number
- Minimum operation to make all elements equal in array
- Insert a node after the n-th node from the end
- Check if a graphs has a cycle of odd length
- Number of substrings with count of each character as k
- Count unset bits of a number
- Array range queries over range queries
- Convert singly linked list into circular linked list
- Maximize the binary matrix by filpping submatrix once
- Remove array end element to maximize the sum of product
- Lexicographically first alternate vowel and consonant string
- Permutations to arrange N persons around a circular table
- K-th ancestor of a node in Binary Tree
- Generate two output strings depending upon occurrence of character in input string.
- Sort string of characters
- Right view of Binary Tree using Queue
- Number of ways to arrange N items under given constraints
- Count single node isolated sub-graphs in a disconnected graph
- Unique element in an array where all elements occur k times except one
- Kth ancestor of a node in binary tree | Set 2
- Largest number with one swap allowed
- Linked List Sum of Nodes Between 0s
- Check if a string is suffix of another
- Sudo Placement[1.4] | BST Traversal
- Longest alternating sub-array starting from every index in a Binary Array
- Generate all passwords from given character set
- Check whether a number has exactly three distinct factors or not
- Longest Repeated Subsequence
- Check if a two character string can be made using given words
- Node having maximum sum of immediate children and itself in n-ary tree
- Sort a Rotated Sorted Array
- Replace nodes with duplicates in linked list
- Number of triangles that can be formed
- Number of subarrays having absolute sum greater than K | Set-2
- Maximize value of (a[i]+i)*(a[j]+j) in an array
- Count of strings where adjacent characters are of difference one
- k-th missing element in increasing sequence which is not present in a given sequence
- Lexicographically smallest string whose hamming distance from given string is exactly K
- Generate permutations with only adjacent swaps allowed
- Tile Stacking Problem
- Print k numbers where all pairs are divisible by m
- Secretary Problem (A Optimal Stopping Problem)
- Pairs of Positive Negative values in an array
- Given a HUGE number check if it's a power of two.
- Remove all consecutive duplicates from the string
- Direction of a Point from a Line Segment
- Cumulative frequency of count of each element in an unsorted array
- Index Mapping (or Trivial Hashing) with negatives allowed
- Count of strings that can be formed from another string using each character at-most once
- Even numbers at even index and odd numbers at odd index
- Queries for the product of first N factorials
- Program to sort string in descending order
- Lexicographically smallest permutation with distinct elements using minimum replacements
- Double Base Palindrome
- Distinct permutations of the string | Set 2
- Minimum number of elements to add to make median equals x
- Average numbers in array
- Replace a character c1 with c2 and c2 with c1 in a string S
- Count all 0s which are blocked by 1s in binary matrix
- Remove all characters other than alphabets from string
- Recursive insertion and traversal linked list
- Root to leaf path with maximum distinct nodes
- Check whether the given array is perfect or not
- Largest increasing subsequence of consecutive integers
- Binary tree to string with brackets
- Make three non-empty sets with negative, positive and 0 products
- Sort an array with swapping only with a special element is allowed
- Sorting using trivial hash function
- Maximum consecutive numbers present in an array
- Count sub-arrays which have elements less than or equal to X
- Minimum Word Break
- Prime factors of a big number
- Frequency of a substring in a string
- Find index of closing bracket for a given opening bracket in an expression
- Smallest number whose set bits are maximum in a given range
- Next word that does not contain a palindrome and has characters from first k
- Construct lexicographically smallest palindrome
- Print Longest Palindromic Subsequence
- Camel case of a given sentence
- Minimum jumps to reach last building in a matrix
- Program to find the minimum (or maximum) element of an array
- Split the string into substrings using delimiter
- Minimum cost to construct a string
- Queries for maximum difference between prime numbers in given ranges
- Count subarrays where second highest lie before highest
- Game of replacing array elements
- DFS traversal of a tree using recursion
- Print n smallest elements from given array in their original order
- Encrypt string with product of number of vowels and consonants in substring of size k
- Construct a graph from given degrees of all vertices
- Form the largest palindromic number using atmost two swaps
- Count number of increasing subsequences of size k
- Reverse a Doubly Linked List | Set-2
- First common element in two linked lists
- Find the size of largest subset of anagram words
- Sorting array of strings (or words) using Trie | Set-2 (Handling Duplicates)
- Number of ways to form a heap with n distinct integers
- Count subarrays with equal number of 1's and 0's
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- Program for triangular patterns of alphabets
- Possible edges of a tree for given diameter, height and vertices
- Minimum difference between groups of size two
- Iterative searching in Binary Search Tree
- Value of k-th index of a series formed by append and insert MEX in middle
- Postorder traversal of Binary Tree without recursion and without stack
- Subsequence queries after removing substrings
- Reverse a Doubly Linked List | Set 4 (Swapping Data)
- Maximum occurring character in an input string | Set-2
- Find a string in lexicographic order which is in between given two strings
- Growable array based stack
- Max occurring divisor in an interval
- Java Program to find largest element in an array
- Latin alphabet cipher
- Median and Mode using Counting Sort
- Minimum array element changes to make its elements 1 to N
- Insertion Sort by Swapping Elements
- Convert string X to an anagram of string Y with minimum replacements
- Reduce Hamming distance by swapping two characters
- Find the Degree of a Particular vertex in a Graph
- Find number of pairs in an array such that their XOR is 0
- Water Connection Problem
- Count maximum-length palindromes in a String
- Lexicographical concatenation of all substrings of a string
- Stable sort for descending order
- Sum of the alphabetical values of the characters of a string
- Balanced expressions such that given positions have opening brackets
- Height of a generic tree from parent array
- Print alternate nodes of a linked list using recursion
- Maximum number of trailing zeros in the product of the subsets of size k
- Linked List Pair Sum
- Print the alternate nodes of linked list (Iterative Method)
- Alternate Odd and Even Nodes in a Singly Linked List
- Count pairs from two sorted matrices with given sum
- Consecutive sequenced numbers in a string
- Modify a binary tree to get preorder traversal using right pointers only
- N Queen in O(n) space
- HCF of array of fractions (or rational numbers)
- Iterative program to Calculate Size of a tree
- Non-Repeating Element
- Insertion sort to sort even and odd positioned elements in different orders
- Sum of products of all combination taken (1 to n) at a time
- Row-wise vs column-wise traversal of matrix
- Top three elements in binary tree
- Maximum occurring character in a linked list
- Time taken by Loop unrolling vs Normal loop
- Check whether bits are in alternate pattern in the given range | Set-2
- Primality Test | Set 5(Using Lucas-Lehmer Series)
- Longest Path with Same Values in a Binary Tree
- Sum of maximum elements of all possible sub-arrays of an array
- Convert String into Binary Sequence
- Find common elements in three linked lists
- Insertion in Unrolled Linked List
- Find the only repetitive element between 1 to n-1
- Function to copy string (Iterative and Recursive)
- Check if any valid sequence is divisible by M
- Rank of an element in a stream
- Check if two strings are permutation of each other
- Number of recycled pairs in an array
- Schedule jobs so that each server gets equal load
- Find one extra character in a string
- Get maximum left node in binary tree
- Delete array elements which are smaller than next or become smaller
- Largest subset with maximum difference as 1
- Number of subarrays with m odd numbers
- Maximum Perimeter Triangle from array
- Rat in a Maze with multiple steps or jump allowed
- Minimal moves to form a string by adding characters or appending string itself
- Maximum Subarray Sum Excluding Certain Elements
- Count subarrays with same even and odd elements
- Count substrings with each character occurring at most k times
- Find unique elements in linked list
- Array range queries for searching an element
- Check if two people starting from different points ever meet
- K'th Largest element in BST using constant extra space
- Level order traversal with direction change after every two levels
- Find the Largest Cube formed by Deleting minimum Digits from a number
- Count numbers formed by given two digit with sum having given digits
- Hill Cipher
- Two Dimensional Segment Tree | Sub-Matrix Sum
- Arithmetic Number
- Making elements of two arrays same with minimum increment/decrement
- Lexicographical Maximum substring of string
- Program for Gauss-Jordan Elimination Method
- Print BST keys in given Range | O(1) Space
- Maximum in an array that can make another array sorted
- Program to reverse a string (Iterative and Recursive)
- Maximum adjacent difference in an array in its sorted form
- Lexicographically Kth smallest way to reach given coordinate from origin
- Ways to choose three points with distance between the most distant points <= L
- Count pairs with set bits sum equal to K
- Reverse String according to the number of words
- Postorder successor of a Node in Binary Tree
- System of Linear Equations in three variables using Cramer's Rule
- Maximum product quadruple (sub-sequence of size 4) in array
- Largest set with bitwise OR equal to n
- Partition negative and positive without comparison with 0
- Add n binary strings
- Subtract 1 without arithmetic operators
- Find the only element that appears b times
- Longest arithmetic progression with the given common difference
- Longest subarray such that adjacent elements have at least one common digit | Set 1
- Print concentric rectangular pattern in a 2d matrix
- Multiset Equivalence Problem
- Reverse nodes of a linked list without affecting the special characters
- Vieta's Formulas
- Infix to Prefix conversion using two stacks
- Queries for number of array elements in a range with Kth Bit Set
- Find the number of operations required to make all array elements Equal
- Sum of multiplication of triplet of divisors of a number
- Move first element to end of a given Linked List
- Recursive program to generate power set
- BigInteger andNot() Method in Java
- Repeated Character Whose First Appearance is Leftmost
- Delete leaf nodes with value k
- Duplicates in an array in O(n) time and by using O(1) extra space | Set-3
- Minimum number of prefix reversals to sort permutation of first N numbers
- Number of permutations such that sum of elements at odd index and even index are equal
- Print all distinct integers that can be formed by K numbers from a given array of N numbers
- kth smallest/largest in a small range unsorted array
- Number of sequences which has HEAD at alternate positions to the right of the first HEAD
- Sum of K largest elements in BST using O(1) Extra space
- Rearrange a Linked List in Zig-Zag fashion | Set-2
- nth Rational number in Calkin-Wilf sequence
- Number of Larger Elements on right side in a string
- Count number of steps to cover a distance if steps can be taken in powers of 2
- Permutation of a string with maximum number of characters greater than its adjacent characters
- Minimum element left from the array after performing given operations
- Check if concatenation of two strings is balanced or not
- Count of elements of an array present in every row of NxM matrix
- Longest Common Prefix Matching | Set-6
- Sort an array where a subarray of a sorted array is in reverse order
- Sudo Placement[1.3] | Playing with Stacks
- Sudo Placement[1.3] | Final Destination
- Implement a stack using singly linked list
- Check if a number has same number of set and unset bits
- Merge first half and reversed second half of the linked list alternatively
- Sum of all maximum frequency elements in Matrix
- Sum of all odd frequency elements in a Matrix
- Longest Common Subsequence | DP using Memoization
- Edit distance and LCS (Longest Common Subsequence)
- Find index of first occurrence when an unsorted array is sorted
- Elements of first array that have more frequencies
- Merge Sort with O(1) extra space merge and O(n lg n) time
- Sudo Placement[1.5] | Wolfish
- Absolute difference between the first X and last X Digits of N
- Floor in Binary Search Tree (BST)
- Average of ASCII values of characters of a given string
- Find the multiple of x which is closest to a^b
- Number of elements smaller than root using preorder traversal of a BST
- Check if all array elements are distinct
- Sort first half in ascending and second half in descending order | Set 2
- Print all the pairs that contains the positive and negative values of an element
- Longest substring with count of 1s more than 0s
- Minimum length of jumps to avoid given array of obstacles
- Shortest distance between two nodes in an infinite binary tree
- Find indices of all occurrence of one string in other
- Time difference between expected time and given time
- Minimize the difference between minimum and maximum elements
- Maximum value of XOR among all triplets of an array
- Flatten a binary tree into linked list | Set-2
- Delete array element in given index range [L - R]
- Next Smaller Element
- Counting frequencies of array elements
- Difference between fundamental data types and derived data types
- Number of divisors of product of N numbers
- Lowest Common Ancestor in Parent Array Representation
- Find the maximum node at a given level in a binary tree
- Balanced expressions such that given positions have opening brackets | Set 2
- Check if Queue Elements are pairwise consecutive
- Modulo power for large numbers represented as strings
- Root to leaf path sum equal to a given number in BST
- Preorder from Inorder and Postorder traversals
- FIFO (First-In-First-Out) approach in Programming
- Program to count number of distinct Squares and Cubes upto N
- Count number of primes in an array
- Count ways to reach a score using 1 and 2 with no consecutive 2s
- Lexicographically smallest permutation of a string with given subsequences
- Program to find sum of the given sequence
- Sum of the nodes of a Singly Linked List
- Program to invert bits of a number Efficiently
- Solve the Logical Expression given by string
- Total character pairs from two strings, with equal number of set bits in their ascii value
- Find all angles of a triangle in 3D
- Longest dividing subsequence
- Balance a string after removing extra brackets
- Search an Element in Doubly Circular Linked List
- Maximize the product of four factors of a Number
- Find a palindromic string B such that given String A is a subsequense of B
- Check if given string can be formed by two other strings or their permutations
- Delete every Kth node from circular linked list
- Program to Find the value of cos(nΘ)
- Print the number of set bits in each node of a Binary Tree
- Minimum and Maximum prime numbers in an array
- Sum and Product of all Prime Nodes of a Singly Linked List
- Count Unary Numbers in a Range
- Divide an array into K subarray with the given condition
- Find the winner of the Game to Win by erasing any two consecutive similar alphabets
- Find number of magical pairs of string of length L
- Generating numbers that are divisor of their right-rotations
- Numbers less than N which are product of exactly two distinct prime numbers
- Ways to write N as sum of two or more positive integers | Set-2
- Find the Second Largest Element in a Linked List
- Check if two Linked Lists are permutations of each other
- Program to calculate the value of nCr Efficiently
- Understanding The Coin Change Problem With Dynamic Programming
- Find column with maximum sum in a Matrix
- Find row with maximum sum in a Matrix
- Find the largest good number in the divisors of given number N
- How to access elements of a Square Matrix
- Insert a node in Binary Search Tree Iteratively
- Meta Binary Search | One-Sided Binary Search
- Find Sum of pair from two arrays with maximum sum
- Sum of all the prime numbers in a given range
- Check whether the given number is Euclid Number or not
- Pair of prime numbers with a given sum and minimum absolute difference
- Delete all the even nodes of a Circular Linked List
- Find the product of last N nodes of the given Linked List
- Program to print Spiral Pattern
- Product of all leaf nodes of binary tree
- Sum of Fibonacci Numbers with alternate negatives
- Print Sum and Product of all Non-Leaf nodes in Binary Tree
- Product of non-repeating (distinct) elements in an Array
- Product of all prime numbers in an Array
- Program to replace every space in a string with hyphen
- Check if suffix and prefix of a string are palindromes
- Minimum number of nodes in an AVL Tree with given height
- Product of the alternate nodes of linked list
- Sum of the alternate nodes of linked list
- Kth prime number greater than N
- Find the longest common prefix between two strings after performing swaps on second string
- Find the common nodes in two singly linked list
- Remove even frequency characters from the string
- Sum of Fibonacci numbers at even indexes upto N terms
- Sub-strings having exactly k characters that have ASCII value greater than p
- Count triplets in a sorted doubly linked list whose product is equal to a given value x
- Sort prime numbers of an array in descending order
- Maximize the sum of array by multiplying prefix of array with -1
- Count the numbers < N which have equal number of divisors as K
- Check if all the palindromic sub-strings are of odd length
- Reduce the string by removing K consecutive identical characters
- Linked List Product of Nodes Between 0s
- Lexicographically largest string formed from the characters in range L and R
- Search in a sorted 2D matrix (Stored in row major order)
- How to Remove Duplicates from ArrayList in Java
- Print all nodes between two given levels in Binary Tree
- Check whether bitwise OR of N numbers is Even or Odd
- Remove characters from string that appears strictly less than K times
- Replace all occurrences of pi with 3.14 in a given string
- Find length of longest Fibonacci like subsequence
- Maximum number of Unique integers in Sub-Array of given size
- Get K-th letter of the decoded string formed by repeating substrings
- Find the smallest after deleting given elements
- String after processing backspace characters
- Replace every elements in the array by its frequency in the array
- Number of leading zeros in binary representation of a given number
- Maximizing the elements with a[i+1] > a[i]
- Find array elements with frequencies in range [l , r]
- Remove elements from the array whose frequency lies in the range [l, r]
- Assign other value to a variable from two possible values
- Longest subarray in which all elements are greater than K
- Problem of 8 Neighbours of an element in a 2-D Matrix
- Check whether a number has consecutive 0's in the given base or not
- Find subsequences with maximum Bitwise AND and Bitwise OR
- Replace consonants with next immediate consonants alphabetically in a String
- Convert all lowercase characters to uppercase whose ASCII value is co-prime with k
- Replace all consonants with nearest vowels in a string
- Array elements with prime frequencies
- Sum and Product of all the nodes which are less than K in the linked list
- Number of ways to partition a string into two balanced subsequences
- Count subarrays with all elements greater than K
- Count and Sum of composite elements in an array
- Lexicographically smallest string formed by removing at most one character
- Maximum number of contiguous array elements with same number of set bits
- Print nodes of linked list at given indexes
- Check whether it is possible to make both arrays equal by modifying a single element
- Count of Prime Nodes of a Singly Linked List
- Find maximum distance between any city and station
- Program to find Prime Numbers Between given Interval
- Sum and Product of all Composite numbers which are divisible by k in an array
- Check whether all the rotations of a given number is greater than or equal to the given number or not
- Sum of every K’th prime number in an array
- Check whether frequency of characters in a string makes Fibonacci Sequence
- Product of all the Composite Numbers in an array
- Program to find the smallest element among three elements
- XOR of Prime Frequencies of Characters in a String
- Longest subarray with elements having equal modulo K
- Count occurrences of the average of array elements with a given number
- Number of sub-arrays that have at least one duplicate
- Minimum number of elements to be removed so that pairwise consecutive elements are same
- Rearrange a string in the form of integer sum followed by the minimized character
- Multiplication of two polynomials using Linked list
- Find if array has an element whose value is half of array sum
- Sort elements of array whose modulo with K yields P
- Array implementation of queue (Simple)
- Paths with maximum number of 'a' from (1, 1) to (X, Y) vertically or horizontally
- Difference between a Static Queue and a Singly Linked List
- Print all numbers less than N with at-most 2 unique digits
- Check whether count of distinct characters in a string is Prime or not
- Search a node in Binary Tree
- Largest right circular cone that can be inscribed within a sphere
- Largest cube that can be inscribed within a right circular cone
- Find all numbers that divide maximum array elements
- Generate a sequence with the given operations
- Check if the array has an element which is equal to product of remaining elements
- Sort perfect squares in an array at their relative positions
- Common prime factors of two numbers
- Total number of subsets in which the product of the elements is even
- Largest cube that can be inscribed within a right circular cylinder
- Count pairs with Bitwise XOR as EVEN number
- Minimum element of each row and each column in a matrix
- Program to convert the diagonal elements of the matrix to 0
- Find largest number smaller than N with same set of digits
- Sum of elements in an array having prime frequency
- Final string after performing given operations
- Sum of elements whose square root is present in the array
- Level Order Successor of a node in Binary Tree
- Find smallest and largest element from square matrix diagonals
- Minimum number of moves to make all elements equal
- Second Chance (or Clock) Page Replacement Policy
- Find the largest interval that contains exactly one of the given N integers.
- Find alphabet in a Matrix which has maximum number of stars around it
- Time taken by two persons to meet on a circular track
- Delete all Non-Prime Nodes from a Singly Linked List
- Rearrange all elements of array which are multiples of x in decreasing order
- Sum of Bitwise-OR of all subarrays of a given Array | Set 2
- Number of sub-strings which are anagram of any sub-string of another string
- Find maximum among all right nodes in Binary Tree
- Ceiling of every element in same array
- Digits of element wise sum of two arrays into a new array
- Number of Paths of Weight W in a K-ary tree
- Sum of elements in an array with frequencies greater than or equal to that element
- Find a sub matrix with maximum XOR
- Sort the array in a given index range
- Find k-th character of decrypted string | Set - 2
- Remove all continuous occurrences of 'a' and all occurrences of 'b'
- Count numbers upto N which are both perfect square and perfect cube
- Subtraction in the Array
- Average of remaining elements after removing K largest and K smallest elements from array
- Count the number of special permutations
- Substring Reverse Pattern
- Largest palindromic prime in an array
- Sum of elements from an array having even parity
- Check if the string satisfies the given condition
- Flatten a binary tree into linked list | Set-3
- Count of numbers which can be made power of 2 by given operation
- Count of Numbers in Range where first digit is equal to last digit of the number
- Minimum number of operations required to sum to binary string S
- Split a string in equal parts such that all parts are palindromes
- Number of array elements derivable from D after performing certain operations
- Print first N terms of series (0.25, 0.5, 0.75, ...) in fraction representation
- Minimize the maximum minimum difference after one removal from array
- Count distinct substrings that contain some characters at most k times
- Length of Diagonal of a n-sided regular polygon
- Count number of pairs (i, j) such that arr[i] * arr[j] > arr[i] + arr[j]
- Minimum absolute difference between N and a power of 2
- Finding in and out degrees of all vertices in a graph
- Maximum value of arr[i] % arr[j] for a given array
- Generate permutation of 1 to N such that absolute difference of consecutive numbers give K distinct integers
- Smallest multiple of 3 which consists of three given non-zero digits
- Ways to paint N paintings such that adjacent paintings don't have same colors
- Check if a number can be expressed as sum two abundant numbers
- Ternary Search
- Find nth term of the series 5 2 13 41
- Find Pth term of a GP if Mth and Nth terms are given
- Count distinct elements in an array
- Replace each node with its Surpasser Count in Linked List
- Program to check if a number is divisible by any of its digits
- Generate lexicographically smallest string of 0, 1 and 2 with adjacent swaps allowed
- Check if a number can be represented as a sum of 2 triangular numbers
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Make Binary Search Tree
- Minimum replacements to make adjacent characters unequal in a ternary string
- Minimum replacements such that the difference between the index of the same characters is divisible by 3
- Form lexicographically smallest string with minimum replacements having equal number of 0s, 1s and 2s
- Modify the string by swapping continuous vowels or consonants
- Maximize the subarray sum after multiplying all elements of any subarray with X
- Maximize the value of x + y + z such that ax + by + cz = n
- Maximum money that can be withdrawn in two steps
- Number of sub-strings that contain the given character exactly k times
- Maximum size of sub-array that satisfies the given condition
- Lexicographically largest sub-sequence of the given string
- Iterative Method To Print Left View of a Binary Tree
- Count triplet pairs (A, B, C) of points in 2-D space that satisfy the given condition
- Find the integers that doesnot ends with T1 or T2 when squared and added X
- Sum of minimum elements of all possible sub-arrays of an array
- Find the number of points that have atleast 1 point above, below, left or right of it
- Find sub-matrix with the given sum
- Number of strings that satisfy the given condition
- Print Leaf Nodes at a given Level
- Program to implement Run Length Encoding using Linked Lists
- Check whether the point (x, y) lies on a given line
- Generate a random permutation of elements from range [L, R] (Divide and Conquer)
- Merge K sorted arrays | Set 3 ( Using Divide and Conquer Approach )
- Minimize the sum of the squares of the sum of elements of each group the array is divided into
- Delete nodes which have a greater value on right side using recursion
- Program to construct a DFA which accept the language L = {a
^{n}b^{m}| n mod 2=0, m≥1} - Search element in a Spirally sorted Matrix
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Minimum removals to make array sum odd
- Maximum Bitwise AND pair from given range
- Print All Leaf Nodes of a Binary Tree from left to right | Set-2 ( Iterative Approach )
- Count array elements that divide the sum of all other elements
- Longest sub-sequence of array containing Lucas numbers
- Find Nth positive number whose digital root is X
- Bitwise AND of N binary strings
- Number of trailing zeroes in base B representation of N!
- Sum of minimum element of all subarrays of a sorted array
- k-th missing element in an unsorted array
- Count all elements in the array which appears at least K times after their first occurrence
- Two equal sum segment range queries
- Character pairs from two strings with even sum
- Minimum matches the team needs to win to qualify
- Minimum cost to make a string free of a subsequence
- Given number of matches played, find number of teams in tournament
- Find Nth term of the series 1, 6, 18, 40, 75, ....
- Find Nth term of the series 1, 5, 32, 288 ...
- Longest double string from a Palindrome
- Minimum sum path between two leaves of a binary tree
- Maximize the summation of numbers in a maximum of K moves in range [L, R]
- Print all the sum pairs which occur maximum number of times
- Print the last k nodes of the linked list in reverse order | Iterative Approaches
- Sum of the series (1*2) + (2*3) + (3*4) + ...... upto n terms
- Count of a, b & c after n seconds for given reproduction rate
- Smallest integer > 1 which divides every element of the given array
- Encrypt a string by repeating i-th character i times
- Maximum number that can be display on Seven Segment Display using N segments
- Sum of (maximum element - minimum element) for all the subsets of an array.
- Minimum steps to make all the elements of the array divisible by 4
- Distinct state codes that appear in a string as contiguous sub-strings
- Find sum of a[i]%a[j] for all valid pairs
- Print leaf nodes in binary tree from left to right using one stack
- Reverse Anti Clockwise Spiral Traversal of a Binary Tree
- Count of numbers from range [L, R] whose sum of digits is Y
- Program to Encrypt a String using ! and @
- Last digit of Product of two Large or Small numbers (a * b)
- Count how many times the given digital clock shows identical digits
- Minimum cuts required to convert a palindromic string to a different palindromic string
- Count maximum elements of an array whose absolute difference does not exceed K
- First string from the given array whose reverse is also present in the same array
- Count of pairs from 1 to a and 1 to b whose sum is divisible by N
- Minimum changes required such that the string satisfies the given condition
- Check if Matrix remains unchanged after row reversals
- Smallest and Largest N-digit perfect squares
- Find if the given number is present in the infinite sequence or not
- Generate all the binary strings of N bits
- Maximum trace possible for any sub-matrix of the given matrix
- Minimum value among AND of elements of every subset of an array
- Check if the given array can be reduced to zeros with the given operation performed given number of times
- Count sub-arrays whose product is divisible by k
- Minimum steps to delete a string by deleting substring comprising of same characters
- Maximum sum from three arrays such that picking elements consecutively from same is not allowed
- Find a distinct pair (x, y) in given range such that x divides y
- Number of ways of scoring R runs in B balls with at most W wickets
- Programs for printing pyramid patterns using recursion
- Loss when two items are sold at same price and same percentage profit/loss
- Sum of Fibonacci Numbers in a range
- Maximum sub-tree sum in a Binary Tree such that the sub-tree is also a BST
- Maximum volume of cube for every person when edge of N cubes are given
- Determine the number of squares of unit area that a given line will pass through.
- Count nodes with two children at level L in a Binary Tree
- Spanning Tree With Maximum Degree (Using Kruskal's Algorithm)
- Sum of degrees of all nodes of a undirected graph
- Replace array elements by sum of next two consecutive elements
- Count the number of non-increasing subarrays
- Print all leaf nodes of a binary tree from right to left
- Pairs of strings which on concatenating contains each character of "string"
- Generate original array from difference between every two consecutive elements
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- Length of the longest substring that do not contain any palindrome
- Minimum steps to color the tree with given colors
- Find the final radiations of each Radiated Stations
- Find original numbers from gcd() every pair
- Count the number of pairs (i, j) such that either arr[i] is divisible by arr[j] or arr[j] is divisible by arr[i]
- Maximum number of people that can be killed with strength P
- Sum of the series Kn + ( K(n-1) * (K-1)1 ) + ( K(n-2) * (K-1)2 ) + ....... (K-1)n
- Find the number of binary strings of length N with at least 3 consecutive 1s
- Find the number of integers x in range (1,N) for which x and x+1 have same number of divisors
- Reduce the fraction to its lowest form
- Lazy Propagation in Segment Tree | Set 2
- Shell-Metzner Sort
- Check if two strings are same ignoring their cases
- Find the number of sub arrays in the permutation of first N natural numbers such that their median is M
- Sum of all the levels in a Binary Search Tree
- Check if matrix A can be converted to B by changing parity of corner elements of any submatrix
- Length of the normal from origin on a straight line whose intercepts are given
- Number of subsequences with zero sum
- Find the maximum possible value of a[i] % a[j] over all pairs of i and j
- Maximize the maximum subarray sum after removing atmost one element
- Sum of elements in 1st array such that number of elements less than or equal to them in 2nd array is maximum
- Given a string and an integer k, find the kth sub-string when all the sub-strings are sorted according to the given condition
- Count different numbers possible using all the digits their frequency times
- Remove all occurrences of any element for maximum array sum
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Highest power of a number that divides other number
- Sum of the series 1, 2, 4, 3, 5, 7, 9, 6, 8, 10, 11, 13.. till N-th term
- Reverse alternate k characters in a string
- Count of sub-strings that contain character X at least once
- Check if given two straight lines are identical or not
- Minimum cost to modify a string
- Find the position of box which occupies the given ball
- Check if string can be made lexicographically smaller by reversing any substring
- Find sum of factorials in an array
- Find the Diameter or Longest chord of a Circle
- Number of character corrections in the given strings to make them equal
- Maximum length of subarray such that sum of the subarray is even
- Sliding Window Maximum (Maximum of all subarrays of size k) using stack in O(n) time
- Sum of all parent-child differences in a Binary Tree
- Shortest distance from the centre of a circle to a chord
- Radius of the circle when the width and height of an arc is given
- Length of direct common tangent between the two non-intersecting Circles
- Length of direct common tangent between two intersecting Circles
- Shortest distance between a point and a circle
- Print even positioned nodes of even levels in level order of the given binary tree
- Count pairs with average present in the same array
- Minimizing array sum by applying XOR operation on all elements of the array
- Count unique numbers that can be generated from N by adding one and removing trailing zeros
- Minimum number of cubes whose sum equals to given number N
- Rat and Poisoned bottle Problem
- Longest alternative parity subsequence
- Number of positions such that adding K to the element is greater than sum of all other elements
- Largest even number that can be formed by any number of swaps
- Find the largest Perfect Subtree in a given Binary Tree
- Iterative Postorder traversal | Set 3
- Check if the robot is within the bounds of the grid after given moves
- Convert Directed Graph into a Tree
- Make lexicographically smallest palindrome by substituting missing characters
- Count number of subsets whose median is also present in the same subset
- Bellman Ford Algorithm (Simple Implementation)
- Choose X such that (A xor X) + (B xor X) is minimized
- Print characters having odd frequencies in order of occurrence
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
- Minimum integer such that it leaves a remainder 1 on dividing with any element from the range [2, N]
- Minimum operations required to change the array such that |arr[i] - M| <= 1
- Minimum number of given operations required to reduce the array to 0 element
- Program to find the rate percentage from compound interest of consecutive years
- Find prime number K in an array such that (A[i] % K) is maximum
- K-th ancestor of a node in Binary Tree | Set 3
- Delete all even elements from a stack
- Minimum sum obtained from groups of four elements from the given array
- Count squares with odd side length in Chessboard
- Check if the number is valid when flipped upside down
- Minimum number of sub-strings of a string such that all are power of 5
- Bitwise AND of sub-array closest to K
- Find letter's position in Alphabet using Bit operation
- Create new linked list from two given linked list with greater element at each node
- Number of trees whose sum of degrees of all the vertices is L
- Queries for bitwise OR in the index range [L, R] of the given array
- Find the last non repeating character in string
- Generate all unique partitions of an integer | Set 2
- Check if the given Prufer sequence is valid or not
- Print an N x M matrix such that each row and column has all the vowels in it
- Find N distinct numbers whose bitwise Or is equal to K
- Count the nodes of the given tree whose weighted string is a palindrome
- Count the nodes of the tree whose weighted string contains a vowel
- Exterior angle of a cyclic quadrilateral when the opposite interior angle is given
- Factorial of an Array of integers
- Find the permutation p from the array q such that q[i] = p[i+1] - p[i]
- Print the degree of every node from the given Prufer sequence
- Distance between centers of two intersecting circles if the radii and common chord length is given
- Print the node with the maximum degree in the prufer sequence
- Count duplicates in a given linked list
- Find the largest possible k-multiple set
- Length of the perpendicular bisector of the line joining the centers of two circles
- Find the number of Chicks in a Zoo at Nth day
- Check if the two given stacks are same
- Find the smallest positive number missing from an unsorted array : Hashing Implementation
- Sum of XOR of all sub-arrays of length K
- Length of the largest substring which have character with frequency greater than or equal to half of the substring
- Count pairs of characters in a string whose ASCII value difference is K
- Find a way to fill matrix with 1's and 0's in blank positions
- Maximum distance between two unequal elements
- Number of ways to split a binary number such that every part is divisible by 2
- Count of adjacent Vowel Consonant Pairs
- Gap Buffer Data Structure
- Largest sub-string where all the characters appear at least K times
- Construct the Rooted tree by using start and finish time of its DFS traversal
- Run Length Decoding in Linked List
- Find if a binary matrix exists with given row and column sums
- Area of a Regular Pentagram
- Create a Sorted Array Using Binary Search
- Count Distinct Rectangles in N*N Chessboard
- Number of sub-sequence such that it has one consecutive element with difference less than or equal to 1
- Total number of odd length palindrome sub-sequence around each centre
- Print Upper Hessenberg matrix of order N
- Find the node with minimum value in a Binary Search Tree using recursion
- Number of ways to get a given sum with n number of m-faced dices
- Order of indices which is lexicographically smallest and sum of elements is <= X
- Count pairs of elements such that number of set bits in their OR is B[i]
- Add Two Numbers Represented by Linked Lists | Set 3
- Minimum operations to make sum of neighbouring elements <= X
- Queries for number of distinct elements from a given index till last index in an array
- Maximum number of region in which N non-parallel lines can divide a plane
- Kth smallest element in the array using constant space when array can't be modified
- Print first N terms of Lower Wythoff sequence
- Delete Nth node from the end of the given linked list
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Check whether str1 can be converted to str2 with the given operations
- Number of elements from the array which are reachable after performing given operations on D
- Find the minimum number of elements that should be removed to make an array good
- Construct a DFA which accept the language L = {w | w ∈ {a,b}* and Na(w) mod 3 = Nb (w) mod 3}
- Bitonic point in the given linked list
- Construct a DFA which accept the language L = {a
^{n}b^{m}| n > =1, (m) mod 3 = 1} - Reverse a Linked List in groups of given size (Iterative Approach)
- Smallest number greater or equals to N such that it has no odd positioned bit set
- Find a subarray whose sum is divisible by size of the array
- Pair with minimum absolute difference | BST
- Add one to a number represented as linked list | Set 2
- Find the number of paths of length K in a directed graph
- Partiton the string in two parts such that both parts have at least k different characters
- Sort an array without changing position of negative numbers
- Find the position of the given row in a 2-D array
- Unbounded Fractional Knapsack
- Find Leftmost and Rightmost node of BST from its given preorder traversal
- Find a partition point in array to maximize its xor sum
- Check if the given n-ary tree is a binary tree
- Length of longest subarray in which elements greater than K are more than elements not greater than K
- Count of strings in the first array which are smaller than every string in the second array
- Find distinct characters in distinct substrings of a string
- Check if it is possible to redistribute the Array
- Count of non-overlapping sub-strings "101" and "010" in the given binary string
- Programs to print Triangle and Diamond patterns using recursion
- Number of Quadruples with GCD equal to K
- Decimal to Binary using recursion and without using power operator
- Remove Minimum coins such that absolute difference between any two piles is less than K
- Count total set bits in all numbers from 1 to n | Set 2
- Maximum length palindromic substring such that it starts and ends with given char
- Print the lexicographically smallest array by swapping elements whose sum is odd
- Find the number of words of X vowels and Y consonants that can be formed from M vowels and N consonants
- Distinct strings such that they contains given strings as sub-sequences
- Case-specific sorting of Strings in O(n) time and O(1) space
- Minimum Bitwise OR operations to make any two array elements equal
- Partition the array in K segments such that bitwise AND of individual segment sum is maximized
- Count ways to divide circle using N non-intersecting chord | Set-2
- Count equal pairs from given string arrays
- Check if a number is Fermat Pseudoprime
- Find k ordered pairs in array with minimum difference d
- Maximum length sub-array which satisfies the given conditions
- Program to Find the Incenter of a Triangle
- Divide the array in K segments such that the sum of minimums is maximized
- Find array such that no subarray has xor zero or Y
- Sum of the Tan(x) expansion upto N terms
- Find the number of occurrences of a character upto preceding position
- Count of elements that can be deleted without disturbing the mean of the initial array
- Find prime numbers in the first half and second half of an array
- Minimum number of times A has to be repeated such that B is a substring of it
- Euler zigzag numbers ( Alternating Permutation )
- Find smallest positive number Y such that Bitwise AND of X and Y is Zero
- Square root of a number without using sqrt() function
- Program for sum of cosh(x) series upto Nth term
- Modular Exponentiation of Complex Numbers
- Check if the product of every contiguous subsequence is different or not in a number
- Find the kth smallest number with sum of digits as m
- Rearrange the characters of the string such that no two adjacent characters are consecutive English alphabets
- Ramanujan Prime
- Quadruplet pair with XOR zero in the given Array
- Maximum Bitwise AND value of subsequence of length K
- Largest substring with same Characters
- Sum of prime numbers without odd prime digits
- Maximum number of elements without overlapping in a Line
- Remove Nth node from end of the Linked List
- FCFS Disk Scheduling Algorithms
- Sum of the sums of all possible subsets
- Find the number of cells in the table contains X
- How to learn Pattern printing easily?
- Find the smallest positive number missing from an unsorted array | Set 3
- Check whether two points (x1, y1) and (x2, y2) lie on same side of a given line or not
- Find the maximum sum of digits of the product of two numbers
- Find the Deepest Node in a Binary Tree Using Queue STL - SET 2
- Lexicographical smallest alternate Array
- Equal Sum and XOR of three Numbers
- Number of Subsequences with Even and Odd Sum
- Count Set-bits of number using Recursion
- Minimize the cost of buying the Objects
- Sum of digits with even number of 1's in their binary representation
- Remove duplicates from unsorted array using Set data structure
- Find the smallest positive number which can not be represented by given digits
- Sum of all natural numbers from L to R ( for large values of L and R )
- Number of Subsequences with Even and Odd Sum | Set 2
- Count all the permutation of an array
- Find all numbers between range L to R such that sum of digit and sum of square of digit is prime
- Minimum given operations required to convert a given binary string to all 1's
- Reverse every word of the string except the first and the last character
- First N terms whose sum of digits is a multiple of 10
- Sand Timer Flip Counting Problem
- Check if a number is Flavius Number
- Swap Alternate Boundary Pairs
- Probability such that two subset contains same number of elements
- Sum of elements till the smallest index such that there are no even numbers to its right
- Program to find the next prime number
- Count the number of elements which are greater than any of element on right side of an array
- Position of Elements which are equal to sum of all Preceding elements
- Queries for rotation and Kth character of the given string in constant time
- Number of substrings that start with "geeks" and end with "for"
- Maximum XOR of Two Numbers in an Array
- Delete the last leaf node in a Binary Tree
- Find Kth element in an array containing odd elements first and then even elements
- Nth Fibonacci number using Pell's equation
- Area of the largest square that can be formed from the given length sticks using Hashing
- Generate N integers satisfying the given conditions
- Comparing X^Y and Y^X for very large values of X and Y
- Largest substring of str2 which is a prefix of str1
- Count the values greater than X in the modified array
- Find permutation with maximum remainder Sum
- Reverse the given string in the range [L, R]
- Maximum OR value of a pair in an array
- Print characters having even frequencies in order of occurrence
- Queries for the smallest and the largest prime number of given digit
- Count of numbers below N whose sum of prime divisors is K
- Find the count of subsequences where each element is divisible by K
- Generate an array having Bitwise AND of the previous and the next element
- Count occurrences of a prime number in the prime factorization of every element from the given range
- Make the list non-decreasing by changing only one digit of the elements
- Replace elements with absolute difference of smallest element on left and largest element on right
- Number of Subarrays with positive product
- Find number of subarrays with XOR value a power of 2
- Find the minimum capacity of the train required to hold the passengers
- Find the sum of all possible pairs in an array of N elements
- Find out the prime numbers in the form of A+nB or B+nA
- Count of triples (A, B, C) where A*C is greater than B*B
- Count the number of subsequences of length k having equal LCM and HCF
- Contiguous unique substrings with the given length L
- Count of subsets not containing adjacent elements
- Sum of the digits of square of the given number which has only 1's as its digits
- XOR of elements in an array having prime frequency
- Queries to check whether all the elements in the given range occurs even number of times
- Sum of squares of all Subsets of given Array
- Array containing power of 2 whose XOR and Sum of elements equals X
- Find third number such that sum of all three number becomes prime
- Count of Multiples of A ,B or C less than or equal to N
- Total ways of selecting a group of X men from N men with or without including a particular man
- Find the number of strings formed using distinct characters of a given string
- Nth number in a set of multiples of A , B or C
- Check if all elements of binary array can be made 1
- Find numbers which are multiples of first array and factors of second array
- Find the possible permutation of the bits of N
- Count of N-digit numbers in base K with no two consecutive zeroes
- Largest sub-matrix with all equal elements
- Print nodes having maximum and minimum degrees
- QuickSelect (A Simple Iterative Implementation)
- Find Partition Line such that sum of values on left and right is equal
- Sum of Digits of the Good Strings
- Minimum halls required for class scheduling
- Find the count of natural Hexadecimal numbers of size N
- Find a pair (n,r) in an integer array such that value of nCr is maximum
- Maximize the expression (A AND X) * (B AND X) | Bit Manipulation
- Minimum number of substrings the given string can be splitted into that satisfy the given conditions
- Sum of numbers in a range [L, R] whose count of divisors is prime
- Minimum number of additons to make the string balanced
- Maximum number of line intersections formed through intersection of N planes
- Program to find Nth odd Fibonacci Number
- Count of N-bit binary numbers without leading zeros
- Find the next fibonacci number
- Find missing elements from an Array
- Divide the array into minimum number of sub-arrays having unique elements
- Find the minimum value of X for an expression
- Minimum increment or decrement operations required to make the array sorted
- Largest Even and Odd N-digit numbers in Octal Number System
- Number of coloured 0's in an N-level hexagon
- Program to print the Diagonals of a Matrix
- Count number of ways to arrange first N numbers
- Count non-adjacent subsets from numbers arranged in Circular fashion
- Minimum, maximum and average price values for all the items of given type
- Number of ways N can be divided into four parts to construct a rectangle
- Length of the longest subsegment which is UpDown after inserting atmost one integer
- Finding the converging element of the diagonals in a square matrix
- Find the deleted value from the array when average of original elements is given
- Probability that a random pair chosen from an array (a[i], a[j]) has the maximum sum
- Count of matchsticks required to represent the given number
- Number of K length subsequences with minimum sum
- Maximum number of times str1 appears as a non-overlapping substring in str2
- Number of subsets whose mean is maximum
- Sum of all the numbers in the Nth parenthesis
- Minimum numbers with one's place as 9 to be added to get N
- Number of cells in the Nth order figure
- Sum of all the numbers in the Nth row of the given triangle
- Make the array non-decreasing with the given operation
- Count of pairs in an array such that the highest power of 2 that divides their product is 1
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Number of index pairs such that s[i] and s[j] are anagrams
- Increasing permutation of first N natural numbers
- Coxeter method to construct the magic square
- Minimize sum by dividing all elements of a subarray by K
- Count of integers obtained by replacing ? in the given string that give remainder 5 when divided by 13
- Maximum sum of minimums of pairs in an array
- Minimum number of moves to reach N starting from (1, 1)
- Find the number of squares inside the given square grid
- Count of subsets with sum equal to X
- Count of squares that can be drawn without lifting the pencil
- Number of subsets with a given AND value
- Longest sub-sequence with minimum LCM
- Number of subsets with a given OR value
- Sum of subsets of all the subsets of an array | O(2^N)
- Sum of subsets of all the subsets of an array | O(N)
- Longest subsequence whose sum is divisible by a given number
- Find all palindrome numbers of given digits
- Number of non-decreasing sub-arrays of length less than or equal to K
- Maximum number of splits of a binary number
- Longest subsequence with a given AND value | O(N)
- Check the divisibility of Hexadecimal numbers
- Minimum difference between any two primes from the given range
- Maximum prime moves to convert X to Y
- Longest subsequence with a given OR value : Dynamic Programming Approach
- Program for nth Fuss–Catalan Number
- Rearrange array elements such that Bitwise AND of first N - 1 elements is equal to last element