Category: Intermediate

0

Sum of length of subsets which contains given value K and all elements in subsets are less than equal to K.

Objective: Given an array of numbers and integer K. Your task is to find lengths of all the subsets which contain value K and all elements in the subset are less than equal to...

0

Find all unique combinations of numbers (from 1 to 9 ) with sum to N

Objective: Given an integer N, Write an algorithm to select numbers from 1 to 9 and make combinations such that its sum to N.  Example: N= 5 Output:  [1, 4] [2, 3] [5] N...

0

Activity Selection Problem

Objective: The activity selection problem is a combinatorial optimization problem concerning the selection of non-conflicting activities to perform within a given time frame, given a set of activities each marked by a start time...

0

Check If Given Undirected Graph is a tree

Objective: Given an undirected graph, Write an algorithm to determine whether its tree or not. An undirected graph is a tree if it has properties mentioned below There is no cycle present in the...

0

Check the completeness of given binary tree | Set 2 – Using Level Order Traversal

Objective: Given a binary tree, write an algorithm to determine whether the tree is complete or not using Level order traversal. Earlier we had solved this problem by counting the number of nodes in...

0

Check the completeness of given binary tree | Set 1 – Using Node Count

Objective: Given a binary tree, write an algorithm to determine whether the tree is complete or not.  Complete Binary Tree: A binary tree T with n levels is complete if all levels except possibly...

0

Number of Islands using BFS

Objective: Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. Assume...

0

Longest substring with at most K unique characters

Objective: Given a string, write an algorithm to find the longest substring with at most K characters. Example: Input: aabbaacdeeeeddded, K = 3 Output: Longest substring with 3 most unique characters is: cdeeeeddded with...

0

Collatz Conjecture – Maximum Steps takes to transform (1, N) to 1.

Objective: Given a number N, write an algorithm to find the maximum number of steps it takes to transform (1, N) to 1 using Collatz Conjecture.  The Collatz conjecture is a conjecture in mathematics...

0

Determine the given routing number belong to which bank

Objective: Given the banks and range of routing numbers for each bank. You have given a routing number, write a program to determine which bank it belongs to. Input: Given a list of routing...

0

Check if interval is covered in given coordinates

Objective: Given 1-D list of coordinates, (x1, x2), (x3, x4), , , ,(xn-1, xn)and interval (a, b). Write an algorithm to determine if interval (a,b) is covered in the list of coordinates. Example: Coordinates...

%d bloggers like this: