We have a set of elements. And a product K. The task is to check whether there exist two numbers in the linked list, whose product is same as K. If there are two numbers, then print them, if there are more than two numbers, then print any of them. Suppose the linked list is like this {2, 4, 8, 12, 15}, and k value is 16. then it will return (2, 8)We will solve this using the hashing technique. Take one hash table, and mark all elements as 0. Now iteratively mark all elements as 1 in hash table, ... Read More
It has been 10 years since the cloud computing revolution has begun in the information and technology sector. It has completely transformed the dimension of the sector, in terms of quality of service delivery and cost of service delivery. During the initial phase of the cloud revolution, it had faced security issues and performance issues. Continuous research on these issues had made the cloud to overcome and brought trust among the clients on the service providers. We are now in the second phase of cloud revolution. As many have started migrating towards the cloud, the demand for providing quality service ... Read More
We have one matrix of order N x M. And a product K. The task is to check whether a pair with the given product is present in the matrix or not.Suppose a matrix is like below −12345678910111213141516Now if the K is 42, then there is a pair like (6, 7)To solve this problem, we will use hashing. We will create hash table by taking all elements of the matrix. We will start traversing the matrix, while traversing, check whether the current element of the matrix is divisible by the given product, and when the product K is divided by ... Read More
Are you working with thousands of files? Do you forget the recently modified documents in Linux? but know where you have saved those files.? Then, this article is for you to identify and list down recently modified records in Linux.Using Find CommandThe following command is helpful to identify sorted files in the reverse order of update time-$ find /etc -type f -printf '%TY-%Tm-%Td %TT %p' | sort -rThe sample output should be like this –2016-12-22 11:10:18.2928833250 /etc/cups/subscriptions.conf 2016-12-22 11:09:18.1987314780 /etc/cups/subscriptions.conf.O 2016-12-20 10:38:47.1524556320 /etc/init.d/.depend.stop 2016-12-20 10:38:47.1524556320 /etc/init.d/.depend.start 2016-12-20 10:38:47.1524556320 /etc/init.d/.depend.boot 2016-12-19 13:28:14.3963910250 /etc/ld.so.cache 2016-12-19 13:28:05.8242856890 /etc/mailcap 2016-12-19 13:24:12.4493955340 /etc/apt/sources.list.d/rvm-ubuntu-smplayer-xenial.list 2016-12-19 13:24:12.4493955340 ... Read More
Suppose there are two numbers. We have to check whether a number is divisible by all of the prime factors or the second number or not. Suppose a number is 120. The prime factors are {2, 3, 5}, another number is 75, here the prime factors are {3, 5}. As 120 is divisible by 3 and 5 also, then the decision is yes.If one number is 1, then it has no prime divisors, so answer is True. Otherwise we have to find the GCD of these two numbers. If GCD is 1, then they are co-prime. So answer is false. ... Read More
Here we will see whether a number is Bleak or not. A number is said to be bleak if it cannot be represented as sum of a positive number x and set bit count in x. So x + set_bit_count(x) is not equal to n , for any non-negative number x.The concept is very simple, if the set bit count + the number is not same as the number, then that is Bleak, otherwise it is not.Example Live Demo#include using namespace std; int set_bit_count(int x) { unsigned int bit_count = 0; while (x != 0) { ... Read More
You see them here, there, on the pathways, on the streets, across bridges, inside parks, inside shopping malls between buildings, behind parking lots, and basically anywhere outdoors imaginable. It seems as if the world has been invaded by a huge fleet of ‘Pokemon Go Zombies’ or more generally called ‘Pokemon-goers’.What’s all the Fuss about?Despite mixed reviews and a tad bit of criticism from game critics, Pokemon Go has become quite a phenomenon since its release on the 6th of July, 2016. It is basically a game that makes the use ofthe GPS and the Camera of any Android or IOS ... Read More
Here we will see a number is unusual number or not. A number is said to be unusual if the greatest prime factor of the number is strictly greater than square root of the number. Some of the unusual numbers are: 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 20, 21, 22, 23, 26, 28, 29, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46To solve this, we will try to find the largest prime factor, then check whether the factor is greater than square root of the number or not. If yes, ... Read More
We have a list L, with n elements. We have to check whether the list is pairwise sorted or not. Suppose the list is like {8, 10, 18, 20, 5, 15}. This is pairwise sorted as (8, 10), (18, 20), (5, 15) are sorted. If the list has odd number of elements, then last one will be ignored.The approach is too simple, traverse the number from left to right. Two consecutive elements are taken, and check whether they are sorted or not, if any one pair is not sorted, return false, if no pair is found, that is unsorted, return ... Read More
One of the most captivating branches of Computer Science – the Artificial Intelligence (AI) – has been thriving on technological fronts. AI is currently used in the programming of computer games, understanding of natural human languages (Apple’s Siri and Microsoft Cortana), neural networks and robotics (eg. Sophia – the most advanced human-like robot).Companies are investing in AI and the percentage is increasing year on year – 38% in 2016 to 62% in 2018, with an expected increase in market growth from Dollars 8 billion in 2016 to Dollars 47 billion in 2020 as per Forbes recent publication.Here the hottest technologies ... Read More