Tag: Length
-
How to find the leader numbers in an array from the reverse direction
This is the first solution to find the leader numbers in an array from the backward 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
-
How to find the minimum and maximum length strings in a sentence of strings using stream
This is the third solution to find the maximum and minimum length strings from a given input sentence of strings, using the reduce() methods of stream.
-
How to reverse each word in a sentence using StringBuffer class
This is the third solution to reverse each word in the given input sentence. This program uses the Single Abstract method, which implemented by using Lambda expression.
-
How to find sum of digits in an integer value
This is the second solution to find the sum of digits of an integer value[s]. This solution defines a functional interface with single abstract method with lambda expression. The internal core logic converts an integer value to String, then parse each character to digit, and sums up each digit.
-
How to reverse all the data values in an Array
This is the second solution to reverse all the data values in an Array. This solution uses Java Generics, which defines a Generic method for reversing given Array data values. This solution modifies the same array, and the resultant array has all the data values reversed. The data values are of any type such as…
-
How to find subsets of a given string
This is the third solution to list all the subsets or substrings of a given string. This approach uses functional interface with single abstract method implementation using lambda expression, the internal logic utilizes the String’s class substring method for intermediate processing of all sized sub strings.
-
How to find length of long integer value using String class
This is the second solution to find the length of a given long integer value with help of functional interface and lambda expression. The internal logic is same that is converting long to string, and apply length method.
-
How to find sum of digits in an alpha numeric value
This is the second solution to find the sum of digits from a given alpha numeric value by using a functional interface with single abstract method and lambda expression. Internally it uses String and Character class methods.
-
How to check whether a string is a palindrome
This is the second solution to check whether a given string is palindrome or not. This approach uses a simple predicate with lambda expression, and uses String class methods.
-
How to count number of lines, words and characters in a file
This is the first solution to count number of lines, words and characters in a given file. This approach uses the FileReader, BufferedReader, StringTokenizer and String methods.
