# Tagged: Beginner

## Find all the Armstrong numbers in the given range

Objective: Given a range of integers, wrote a program to find all the Armstrong numbers in that range. What is Armstrong number: Determine the number of digits in the number. Call that n. Then...

## Check if the given binary tree is Full or not.

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

## Check if given undirected graph is connected or not

Objective: Given an undirected graph, write an algorithm to find out whether the graph is connected or not.  Graph Connectivity: If each vertex of a graph is connected to one or multiple vertices then...

## Print boundary of given matrix/2D array.

Objective: Given a two-dimensional array, write a program to print the boundary of the array. Example: int [][] grid = new int[][] { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 8, 7,...

## Depth-First Search (DFS) in 2D Matrix/2D-Array – Iterative Solution

Objective: Given a two-dimensional array or matrix, Do the depth-First Search (DFS) to print the elements of the given matrix. Implement the Depth-first traversal in an iterative manner. Example: int [][] grid = new...

## Print Stack in reverse order.

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

## Given an array, Print sum of all subsets

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 , , , [1, 2]...

## Maximum number edges to make Acyclic Undirected/Directed Graph

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

## Hamming Distance between two given strings

Objective: Given two strings with equal lengths, write an algorithm to calculate the hamming distance between the strings.  Hamming Distance: Hamming distance between two strings is the number of positions at which the characters...

## Check if Number is divisible by its digits

Objective: Given a number, write a program to check if the number is divisible by all of its digits separately. Example: N = 15 Output: true (15 is divisible by 1 and 5) N...

## Check if the given number is Armstrong number or not

Objective: Given a number, write a program to find out whether the number is Armstrong number or not What is Armstrong number: Determine the number of digits in the number. Call that n. Then...

## Find all the numbers in the range which has prime set bits.

Objective: Given a range, find all the numbers in the range which has prime set bits. Example: L = 4, R = 10 Output: 5 Explanation: 4 = 1 0 0 ( not prime)...

## Reverse the Directed Graph

Objective: Given a directed graph, write an algorithm to reverse the graph.  Example:  Approach: Create a new graph with the same number of vertices. Traverse the given graph. Here we are using the adjacency...

## Find Third Smallest elements in a given array

Objective: Given an array of integers, write an algorithm to find the third smallest element in the array. Example: Int [] a = { 6, 8, 1, 9, 2, 10}; Output: Third smallest element...

## Find the maximum number present in a String

Given a string with alphabets and numbers. Write an algorithm to find the maximum number in the string. If any number is greater than equal to Max_Value of integer then return the Max_Value. Example:...