Docker is an open-source project that automates the deployment of application inside the software container. The container allows the developer to package up all project resources such as libraries, dependencies, assets etc. Docker is written in Go Programming language and is developed by Dotcloud. It is basically a container engine which uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system and automates the application deployment on the container.Installing DockerBefore installing Docker on CentOS, it is required to update CentOS packages. To update the packages, use the following commands-# yum -y ... Read More
Suppose we have an array arr and another value k. We have to find a minimum number of operations to make the GCD of the array equal to the multiple of k. In this case, the operation is increasing or decreasing the value. Suppose the array is like {4, 5, 6}, and k is 5. We can increase 4 by 1, and decrease 6 by 1, so it becomes 5. Here a number of operations is 2.We have to follow these steps to get the result −Steps −for all elements e in the array, follow steps 2 and 3if e ... Read More
Suppose we have two strings of equal length, we have to find a minimum number of alterations required to make two strings anagram, without deleting any character. The Anagram is two strings that have the same set of characters. Suppose two strings are “HELLO”, and “WORLD” here number of required changes is 3, as three characters are different in this case.The idea is simple, we have to find the frequency of each character in the first string, then go through the second string, if characters in the second string are present, in the frequency array, then decrease the frequency value. ... Read More
Suppose we have an array arr of size N. it has N positive numbers. We have to find the minimum elements of all possible subarray. Suppose the array is {2, 66, 14, 521}, then minimum LCM is 2, and GCD is 1.We will solve this problem using a greedy approach. If we decrease the number of elements, then LCM will be less, and if we increase the array size, GCD will be less. We need to find the smallest element from the array, which is a single element, which will be required LCM. For GCD, GCD will be GCD of ... Read More
Do you want to optimize the images or compress images without losing its original quality before uploading them to any cloud or local storages? There are plenty of GUI applications or web applications which are available that will help you to optimize the images. This article helps you to optimize and compress JPEG or PNG images in Linux Command Line.Using jpegoptimjpegoptim is a simple utility to optimize JPEG images without losing quality. It provides lossless optimization and “lossy” optimization based on the setting with a maximum quality factor.To install jpegoptim , use the following command –$ sudo apt-get install jpegoptimThe sample ... Read More
Suppose we have an array with N elements. We have to remove element from the array by following the given operations. The operation is like, we have to choose any two numbers of the array, and remove larger. Cost including in this operation is the same as the smaller number. We have to delete only one element at a time, based on this operation, and perform the task in minimum cost. Suppose the array has {4, 2, 5}. I take 4 and 2, remove 4 by paying cost 2, then we remove 5 again with cost 2.The approach is too ... Read More
In this section, we will see how to check whether two strings are meta string or not. The meta strings are those strings that are very much similar. If we swap two elements in one string, then it will be matched with other string. Suppose two strings are “HELLO” and “OELLH”, then they are meta strings.To check whether two strings are meta string or not, we have to follow these steps.Steps −If both strings are of different length, then return falseElse find a number of characters, that have not matched, also store the index of non-matched charactersIf the count is ... Read More
Suppose we have one list of data with positive and negative values. We have to find the sum of contiguous subarray whose sum is largest. Suppose the list is containing {-2, -5, 6, -2, -3, 1, 5, -6}, then the sum of maximum subarray is 7. It is the sum of {6, -2, -3, 1, 5}We will solve this problem by using the Divide and Conquer method. The steps will look like below −Steps −Divide the array into two partsFind the maximum of the following threeMaximum subarray sum of left subarrayMaximum subarray sum of right subarrayMaximum subarray sum such that subarray ... Read More
Here we will see one interesting problem. let us consider we have three integers A, B, and C. We have to find one minimum integer X, such that X mod C = 0, and X is not in the range [A, B]. If the values of A, B and C are 5, 10 and 4 respectively, then the value of X will be 4. We have to follow these steps to get the solution −Steps −If C is not in the range [A, B], then return C as a resultOtherwise get the first multiple of C, which is greater than ... Read More
There are several ways to download MP3 tracks from Youtube such as web applications, windows applications and command line tools in Linux. Youtube-DL is one of the best available tools in the market to download tracks from youtube. It is developed in Python programming language. This program can be used in almost all Linux distributions. If you haven’t heard about this tool then this article is for you.Installing Youtube-DLTo install youtube-DL, use the following command –$ sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dlThe sample output should be like this –--2016-03-08 11:41:21-- https://yt-dl.org/downloads/latest/youtube-dl Resolving yt-dl.org (yt-dl.org)... 95.143.172.170, 2001:1a50:11:0:5f:8f:acaa:177 Connecting to yt-dl.org (yt-dl.org)|95.143.172.170|:443... connected. HTTP request ... Read More