Print Digit of Number In Words
Given a number N, Print digits of that number in words. eg, 100 should be written as One Zero Zero Solution [Using Recursion]
Given a number N, Print digits of that number in words. eg, 100 should be written as One Zero Zero Solution [Using Recursion]
Problem Statement Partitioning the array is said to be a palindrome partitioning if every subarray of the partition is a palindrome. For example, 1 | 2 2 2 | 23 | 4 is a palindrome partitioning of array { 1,2,2,2,23,4 }. Given an integer array, you have to find out the fewest cuts needed for palindrome partitioning. For example,…
Shyam needs to distribute newspaper to all the houses while following these rules: He can start from any vertex. When he is on a vertex, he must distribute the newspaper. You can only travel to a vertex that is connected to the current vertex by an edge. You cannot visit a vertex which is already…
You are given an array of integers and must compute the maximum difference between any item and any lower indexed smaller item for the possible pairs, i.e., for a given array a find the maximum value of a[j] – a[i] for all i, j where 0 <= i < j < n and a[i] <…
Now we can approach it in 2 ways – the first approach is to calculate factorial of a number and then calculate the number of trailing zeros from the result. But for any value greater than 12 we will see integer exceed. So let’s go with the second approach and Find a relation between number and…
PT07Y – Is it a tree #dfs You are given an unweighted, undirected graph. Write a program to check if it’s a tree topology. Input The first line of the input file contains two integers N and M — number of nodes and number of edges in the graph (0 < N <= 10000,…