Given n numbers, each with some frequency of occurrence. Return a random number with probability proportional to its frequency of occurrence. Example: Let follo
Given a value V, if we want to make change for V Rs, and we have infinite supply of each of the denominations in Indian currency, i.e., we have infinite supply
Given a standard football, regular hexagons and pentagons are drawn on it as shown in the picture. Find out the number of hexagons and pentagons. Recommended: P
Given n items of different weights and bins each of capacity c, assign each item to a bin such that number of total used bins is minimized. It may be assumed th
Compute n modulo d without division(/) and modulo(%) operators, where d is a power of 2 number. Let ith bit from right is set in d. For getting n modulus d, we
Given many stacks of coins which are arranged adjacently. We need to collect all these coins in the minimum number of steps where in one step we can collect one
Given two integers, find XOR of them without using XOR operator, i.e., without using ^ in C/C++. Examples : Input: x = 1, y = 2 Output: 3 Input: x = 3, y = 5 Ou
A number is said to be a sparse number if in binary representation of the number no two or more consecutive bits are set. Write a function to check if a given n
Given a number N and a digit D, we have to form an expression or equation that contains only D and that expression evaluates to N. Allowed operators in expressi
Given a tank with capacity C liters which is completely filled in starting. Everyday tank is filled with l liters of water and in the case of overflow extra wat
Given n friends and their friendship relations, find the total number of groups that exist. And the number of ways of new groups that can be formed consisting o
A decimal number is called binary digit number if its digits are binary. For example, 102 is not a binary digit number and 101 is. We are given a decimal number
Given an array of items, an i-th index element denotes the item id’s and given a number m, the task is to remove m elements such that there should be minimum
Given an unsorted array of integers, find the number of subarrays having sum exactly equal to a given number k. Examples: Input : arr[] = {10, 2, -2, -20, 10},
Given an n-ary tree, count number of ways to traverse an n-ary (or a Directed Acyclic Graph) tree starting from the root vertex. Suppose we have a given N-ary t
Problem – Write an assembly language program in 8086 microprocessor to find square root of a number. Example – Algorithm – Move the input data in register
Prerequisite – 8085 program to find the factorial of a number Problem – Write an assembly language program for calculating the factorial of a number using 8
Problem – Write an assembly language program in 8086 microprocessor to search a number in a string of 5 bytes, store the offset where the element is found and
Problem – Assembly level program in 8085 which converts a binary number into ASCII number. Example – Assumptions – Binary number which have to convert in
Problem – Write an assembly language program to find smallest number between two number’s. Example – Algorithm – Load the content from memory location M
Problem – Write an assembly language program for calculating the factorial of a number using 8085 microprocessor. Example – Input : 04H Output : 18H as 04*0
Problem – Write an assembly language program in 8085 microprocessor to find square root of a number. Example – Assumptions – Number, whose square root we
Problem – Write an assembly language code for calculating the nth power of a number using 8085 microprocessor. Example – Input : Base=>02H Exponent=>03H Out
An equivalence relation is Reflexive, Symmetric and Transitive. Before counting the number of possible equivalence relations on a set |A|=n, let us see an examp
Write a C function ftoa() that converts a given floating point number to string. Use of standard library functions for direct conversion is not allowed. The fol