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

Skip to content# Tagged: Beginner

## Print Stack in reverse order.

## Given an array, Print sum of all subsets

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

## Hamming Distance between two given strings

## Check if Number is divisible by its digits

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

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

## Reverse the Directed Graph

## Find Third Smallest elements in a given array

## Find the maximum number present in a String

## Count number of subgraphs in a given graph

## Convert Roman Number to Integer

## Linear Search vs Binary Search

## Count the number of nodes in a given binary tree

## Longest contiguous character in a given String – O(N) Solution

@tutorialhorizon

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

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

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

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

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

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

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

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

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

Objective: Given a Graph, write a program to count all the subgraphs. Example: Approach: Use Depth-First Search Start the DFS from any random vertex. Once DFS is completed check if all the vertices are...

Objective: Given a Roman number, write a program to convert it to Integer. Roman Number – Letters used in Roman numerals and the corresponding numerical values are given in the table below. Rules: ...

Earlier we have seen linear search and binary search and how these work individually, In this article we will compare these two search algorithms. If you are new to these, please read the prerequisites...

Objective: Given a binary tree, write an algorithm to count all the nodes in the tree. Example: Approach: Do postorder traversal. If the root is null return 0. (base case all well for the...

Objective: Given an input string, write an algorithm to find the longest contiguous character or in other words, find a maximum consecutive character in the string. Example: Input: “aaabbccccddbbaaa” Output: c, count = 4...

%d bloggers like this: