Given an string of binary number n. Convert binary fractional n into it’s decimal equivalent. Examples: Input: n = 110.101 Output: 6.625 Input: n =… Read More
Pairwise sum of n (where n >= 3) numbers are given in a specified order, find the numbers. The order has pair sum of first… Read More
Given a sorted integer array and number x, the task is to count pairs in array whose sum is less than x. Examples: Input :… Read More
Question: In the missionaries and cannibals problem, three missionaries and three cannibals must cross a river using a boat which can carry at most two… Read More
Question: Suppose you have a 4 liter jug and a 9 liter bucket . The buckets have no measurement lines on them either. How could… Read More
How to Search in a Sorted Array? In a sorted array, the search operation can be performed by using binary search. Below is the implementation… Read More
In this post, a program to search, insert, and delete operations in an unsorted array is discussed. Search Operation: In an unsorted array, the search… Read More
Set 1 (Generators) Distributions I. Uniform : uniform_int_distribution: It produces random integer values i, which are uniformly distributed on the closed interval [a,b], which is… Read More
Java provides a class with name Class in java.lang package. Instances of the class Class represent classes and interfaces in a running Java application. The… Read More
Given a fraction decimal number n and integer k, convert decimal number n into equivalent binary number up-to k precision after decimal point. Examples: Input:… Read More
A literal is used for representing a fixed value in a program. A literal could be anything in a code like a, b, c2. ,… Read More
Given an array of distinct integers, the task is to find two pairs (a, b) and (c, d) such that ab = cd, where a,… Read More
The combination of two separate processes in Java is known as Double Brace Initialization in Java. As the name suggests, there are two braces {{… Read More