## Stream toArray() in Java with Examples

Stream toArray() returns an array containing the elements of this stream. It is a terminal operation i.e, it may traverse the stream to produce a… Read More »

Stream toArray() returns an array containing the elements of this stream. It is a terminal operation i.e, it may traverse the stream to produce a… Read More »

In this article, we would be going through stream method of Arrays class which is added in Java 8, it simplifies many operations on arrays… Read More »

Given an array of n numbers. Your task is to read numbers from the array and keep at-most K numbers at the top (According to… Read More »

Given a stream of characters and we have to find first non repeating character each time a character is inserted to the stream. Examples: Input… Read More »

Given a stream of integers represented as arr[]. For each index i from 0 to n-1, print the multiplication of largest, second largest, third largest… Read More »

Stream of binary number is coming, the task is to tell the number formed so far is divisible by a given number n. At any… Read More »

Given an infinite stream of integers, find the k’th largest element at any point of time. Example: Input: stream[] = {10, 20, 11, 70, 50,… Read More »

Given a stream of characters (characters are received one by one), write a function that prints ‘Yes’ if a character makes the complete string palindrome,… Read More »

Given a stream of characters, find the first non-repeating character from stream. You need to tell the first non-repeating character in O(1) time at any… Read More »

Given a stream of numbers, generate a random number from the stream. You are allowed to use only O(1) space and the input is in… Read More »

Difficulty Level: Rookie Given a stream of numbers, print average (or mean) of the stream at every point. For example, let us consider the stream… Read More »

Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no… Read More »