I solved the same problem in two different programming languages: Java and Python. The Java program is usually longer in terms of LOCs, it uses more memory and his time execution is slower than Python code. As we can see in the next screenshot:
Python seems to be a better choice, however, Java is still widely used.