Tag: Length
-
How to check whether a number is Disarium or not using stream
This is the second solution to check the number for Disarium. This solution uses IntStream, reduce methods of Stream. The Disarium number is say for a given number 351, evaluate the powers from the left side as power (3 * 1) + power (5 * 2) + power (1 *3) , the sum of all…
-
How to find array triplets with sum of two elements equals other element in the same array using stream
This is the third solution to find array triplets, with sum of any two numbers equals with any other element in the same array. This approach uses IntStream, flatMap, filter, mapToObj of Stream.
-
How to find the leader numbers in an array using stream
This is the third solution to find the leader numbers in an array in the reverse direction using stream. An element is leader if it is greater than all the elements to its right side. And the rightmost element is always a leader
-
How to reverse all the numbers in an array of integers using stream
This is the third solution to reverse all the numbers in the given array. This solution uses IntStream, range and map methods.
-
How to find the leader numbers in an array in the forward direction
This is the second solution to find the leader numbers in an array in the forward direction. An element is leader if it is greater than all the elements to its right side. And the rightmost element is always a leader
