Tag Archives: Set

Prime factors of a number. [Prime Factorization]

Question: Given an integer N, find all the prime factors of the number. Input: N = 45 Output: 3 5 Finding prime factors of any numbers is a very important concept in number theory. One sample problem is available here in which we have to find the largest prime factor. The mathematical concept behind this problem is simple.… Read More »

Determine if two strings share a common sub-string.

Question: Given two strings, determine if they share a common sub-string. If they have a common sub-string, print YES else print NO. Input: studyalgorithms algos Output: YES This is one of the easy problems but can get a little tricky, if we do not understand it completely. Let us try to understand the test case String 1 =… Read More »