How-to articles, tricks, and solutions about ALGORITHM
Finding the max/min value in an array of primitives using Java
To find the maximum value in an array of primitives in Java, you can use the Arrays.stream() method to create a stream from the array, and then use the Stream.max() method to find the maximum element in the stream. Here is an example of how to do this for
Generating all permutations of a given string
To generate all permutations of a given string in Java, you can use a recursive approach.
Group array by subarray values
In PHP, you can group an array of arrays (subarrays) by the value of a specific key in each subarray using the array_reduce() function.
How do I generate all permutations of a list?
You can use the itertools.permutations() function to generate all permutations of a list in Python.
Removing duplicates in lists
There are a few ways to remove duplicates from a list in Python.