[Geeks for Geeks] Longest consecutive subsequence

Longest consecutive subsequence

Given an array of positive integers. Find the length of the longest sub-sequence such that elements in the subsequence are consecutive integers, the consecutive numbers can be in any order.

Read more
[Geeks for Geeks] Kadane`s Algorithm

Kadane’s Algorithm

Given an array Arr[] of N integers. Find the contiguous sub-array(containing at least one number) which has the maximum sum and return its sum.

Read more
[Geeks for Geeks] Trapping Rain Water

Trapping Rain Water

Given an array arr[] of N non-negative integers representing the height of blocks. If width of each block is 1, compute how much water can be trapped between the blocks during the rainy season.

Read more
[Geeks for Geeks] Maximum Product Subarray

Maximum Product Subarray

Given an array Arr[] that contains N integers (may be positive, negative or zero). Find the product of the maximum product subarray.

Read more
[Geeks for Geeks] Minimum Platforms

Minimum Platforms

Given arrival and departure times of all trains that reach a railway station. Find the minimum number of platforms required for the railway station so that no train is kept waiting.

Consider that all the trains arrive on the same day and leave on the same day. Arrival and departure time can never be the same for a train but we can have arrival time of one train equal to departure time of the other. At any given instance of time, same platform can not be used for both departure of a train and arrival of another train. In such cases, we need different platforms.

Read more
[Geeks for Geeks] Sorted Link List to BST

Sorted Link List to BST

Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as the given Linked List.

Note: There might be nodes with same value.

Read more
[Geeks for Geeks] Count Smaller elements

Count Smaller elements

Given an array Arr of size N containing positive integers. Count number of smaller elements on right side of each array.

Read more
[Geeks for Geeks] Word Break (Trie)

Word Break (Trie)

Given a string A and a dictionary of n words B, find out if A can be segmented into a space-separated sequence of dictionary words.

Read more
[Geeks for Geeks] Count occurences of a given word in a 2-d array

Count occurences of a given word in a 2-d array

Find the number of occurrences of a given search word in a 2d-Array of characters where the word can go up, down, left, right and around 90 degree bends.

Read more
[LeetCode] All Elements in Two Binary Search Trees

1305. All Elements in Two Binary Search Trees

Given two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order.

Read more