Print All Numbers Whose Prime Factors are a Subset of X in C++

sudhir sharma
Updated on 22-Jan-2020 09:55:23

254 Views

In this problem, we are given a set of N numbers and a number X. And we have to print all numbers from the array whose set of prime factors is a subset of the set of prime factors of X.Let’s take an example to understand the problemInput: X= 30 , array = {2, 3, 6, 10, 12} Output : 2 3 6To solve this problem, we have to traverse elements of the array. And divide this element with gcd of (element, x). Repeat division till the gcd becomes 1. And print the remaining number.Example Live Demo#include using namespace std; ... Read More

Print All Odd Numbers and Their Sum from 1 to N in PL/SQL

sudhir sharma
Updated on 22-Jan-2020 09:46:19

3K+ Views

In this problem, we are given a number n and we have to print all odd numbers from 1 to n and also print the sum of numbers from 1 to n in PL/SQL.PL/SQL is a procedural language extension to SQL. The code is a sequence of instructions that are ground in a block with all related declarations and instructions.Let’s see an example of our problem −Input: 7 Output: odd numbers are: 1, 3, 5, 7 Sum of odd numbers is 16To solve this problem, we will take a number and initialize it to 1 and a sum variable with ... Read More

Print All Pairs in an Unsorted Array with Equal Sum in C++

sudhir sharma
Updated on 22-Jan-2020 09:42:05

342 Views

In this problem, we have an unsorted array and we have to print all pairs within this array that have an equal sum.Let’s take an example to understand the problem −Input: array = [12, 13, 20, 5] Output: [12, 13] and [20, 5] have sum 25.To solve this problem, we will have to find pairs of the same sum. For this, we will check pairs for the same sum. And to avoid duplicate pairs, we will use the map.For this, we will need two maps, one to store all sum pairs and their sum and others to store all sum ... Read More

Print All Pairs of Anagrams in a Given Array of Strings in C++

sudhir sharma
Updated on 22-Jan-2020 09:37:31

496 Views

In this problem, we are given an array of strings and we have to print all pairs of anagrams of that given array.Anagrams are strings that are formed by rearranging the character of another string. Like − hello and lolheLet’s take an example to understand the problem −Input: array = {“hello”, “hrdef”, “from”, “lohel”, “morf”}. Output: [hello, lohel] , [from , morf]To solve this problem, we will use the nesting of loops. We need two nested loops, the outer loop will traverse over the array and select elements. The nested loop will check each of the string and check if ... Read More

Monitor Your Linux Servers and Websites from Cloud

Sharon Christine
Updated on 22-Jan-2020 09:28:59

333 Views

This article will help you to monitor IT infrastructure, Servers, Websites from the cloud. There is a huge requirement of having a tool to monitor and cloudstats.com fits the bill of a cloud monitoring tool. One of the key feature of this tool is to send you alerts and notifications to the team for CPU, DISK, RAM, Network usage and also monitors the services like Apache, MySQL, Mail, FTP, DNS.Cloudstats.meCloudStats.me is a new monitoring tool from Linux server, which is very easy to use and has a good yet capable feature of providing most vital information of your servers. CloudStats ... Read More

Migrate MySQL to MariaDB on Linux

Sharon Christine
Updated on 22-Jan-2020 08:21:42

477 Views

This article will help you to migrate the database from MySQL to MariaDB as the binary compatibility of MySQL-to-MariaDB in the migration process is very much straightforward.After the Oracle’s acquisition of MySQL, the community has driven an outcome of such movement and developed a new database called MariaDB. MariaDB is the open-source and its compatibility with MySQL. Most of the Linux distributions (RH, CentOS, Fedora) have already started to use the support of MariaDB as a drop-in replacement of MySQL.If we want to migrate the database from MySQL to MariaDB then this article will help.Preparing a MySQL Database and TablesWe ... Read More

Migrating PHP 5.x to PHP 7 on CentOS 7

Samual Sam
Updated on 22-Jan-2020 08:14:19

521 Views

In this article, we will learn about how to upgrade and update PHP 5.x to PHP 7, PHP 7 which was released in 2015 with speed improvements comparable to the older versions of the PHP.PrerequisitesAssuming that we have already installed PHP 5.x on CentOS7, and mod_php module should be enabled by Apache, and we need Sudo privileges or root user.Enabling the PHP 7 RepositoryAs PHP 7.x is not available in the official repositories, so we need to use IUS community Project Repository.Download the IUS repository in the machine with the below command# curl 'https://setup.ius.io/' -o setup-ius.sh curl 'https://setup.ius.io/' -o setup-ius.sh ... Read More

Use Let's Encrypt SSL Certificate to Secure Nginx on CentOS 7

Samual Sam
Updated on 22-Jan-2020 08:12:08

380 Views

In this article, we will learn how to secure Ngnix using a free SSL from Let’s Encrypt, Let’s Encrypt which is a new certifying authority which provides an easy way to obtain and install it for free TSL/SSL certificates. We can enable HTTPS on web servers. Let’s Encrypt has simplified the process by providing a software client which automates most of the steps required for obtaining the SSL from the certifying authority. Currently Let’s Encrypt is still in open beta version. Also note that, the entire process for obtaining and installing the certificate is fully automated.PrerequisitesWe needed a CentOS 7 ... Read More

Kill a Process by Name in Linux

Sharon Christine
Updated on 22-Jan-2020 08:08:36

728 Views

This article shows you how to use the Linux pkill command to kill running processes within Linux by using a name. Pkill (see pgrep) is a command-line utility while Solaris 7 process is running. pkill works on a currently active running process and lists down process ID’s which matches with the criteria.To kill a process by name in Linux, use the following command –pkillTo get a list of process in Linux, use the following command –$ ps -AThe sample output should be like this –PID TTY          TIME CMD    1 ?           ... Read More

Use Nano Text Editor

Samual Sam
Updated on 22-Jan-2020 08:08:03

5K+ Views

Are you confused by all of the other text editors? then, this article is for you! Linux amateurs are often put off by other advanced text editors such as Vim and Emacs. While they are decent programs, they does require a bit of learning curve. Nano offers a perfect solution if you are looking for a small and friendly text editor. It offers many useful and productive features.What is Nano Text Editor?Nano is a text editor for Unix-like systems or any other environments using a command line interface. It emulates the Pico text editor, a part of the Pine email ... Read More

Advertisements