## 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...

@tutorialhorizon

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...

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...

Objective: Given two sets of integers, write an algorithm to print the sum of overlapping elements in two sets. Note: Elements in each set are unique or there are no duplicates within a set....

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...

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...

Objective: Given a binary tree, write an algorithm to check if the tree is Full or not. Full binary tree: A binary tree T is full if each node is either a leaf or...

Objective: Given a stack, write a program to print the stack elements in reverse order. Example: Approach: Use Temporary stack: Take temporary stack, and copy all the items from the given stack to a...

Objective: Given an array of numbers, write an algorithm to print all the subsets sum individually. Example: Given Input: [1, 2] Output: 3 1 2 0 Explanation: subsets are [0], [1], [2], [1, 2]...

Objective: Given an array of integers (in particular order or permutation of a set of numbers), write an algorithm to find the lexicographically previous permutation of the given permutation with only one swap. This...

Objective: Given two integers N and K. Write an algorithm to find all the combinations of k numbers which sum to N. Conditions: All K numbers must be between 1 and 9 and unique....

Given- Given V vertices, what is the maximum number of edges can be added to make Acyclic Undirected Graph. Follow up – what is the maximum number of edges that can be added to...

Earlier we had discussed how to evaluate prefix expression where operands are of single-digit. In this article, we will discuss how to evaluate prefix expression for any number ( not necessarily single digit.) Prefix...

Objective: Given a two-dimensional array or matrix, Write an algorithm to print the given matrix in a zigzag manner or in other words print all the diagonals of the matrix. Example: int [][] grid...

Prefix notation is a notation for writing arithmetic expressions in which the operands appear after their operators. There are no precedence rules to learn. Let’s assume the below Operands are real numbers in real...

Earlier we had discussed how to evaluate postfix expressions where operands are of single-digit. In this article, we will discuss how to evaluate postfix expressions for any number ( not necessarily single digit.) Postfix...

%d bloggers like this: