## Generate numbers from 1 to 7 with equal probability using specified function

Write an algorithm to generate numbers from 1 to 7 with equal probability using a specified function which produces random numbers between 1 to 5 with equal probability.

Coding made easy

Write an algorithm to generate numbers from 1 to 7 with equal probability using a specified function which produces random numbers between 1 to 5 with equal probability.

In this post, we will see how to implement ternary-like operator in C without using conditional expressions like ternary operator, ifâ€“else expression or switch-case statements.

Given an array of integers, find a subset in it that has maximum product of its elements.

We have already covered how to flatten a Stream using flatMap() and concat() methods in Java 8. In this post, we will flatten a Stream in Java 8 using Stream.forEach() method.

Given an unsorted array of integers, print all pairs with given difference k in it without using any extra space.

Given two integers, add their binary representation.

Given an unsorted array of integers, print all pairs with given difference k in it.

In this post, we will discuss the difference between Stream.of() and Arrays.stream() method in Java.

Given a square matrix, rotate the matrix by 180 degrees in clock-wise direction. The transformation should be done in-place in quadratic time.

Given a sorted array containing duplicates, efficiently find frequency of each element in it without traversing the whole array.

Given a number, find out if it is even or odd without using any conditional statement (if-else) or ternary operator.

In this post, we will discuss how to shuffle or randomize a List in Java using Fisherâ€“Yates shuffle algorithm and shuffle() method provided by the Collections class.