1. Ugly Numbers
Ugly numbers are numbers whose only prime factors are 2, 3 or 5. Given a number n, the task is to find n’th Ugly number.
Input
Integer n
Output
N-th Ugly Number
Sample Testcases
I/P : n = 10
O/P : 12
I/P : n = 15
O/P : 24
Solution : https://www.geeksforgeeks.org/ugly-numbers/
2. Special Elements in Matrix
Given a matrix of size m*n, where m denotes the row starting with index 0 and n denotes the column starting with index 0.
Find the distinct number of positional elements which are either the minimum or maximum in their corresponding row or column.
If in case any row or any column has multiple minimum or maximum elements, return -1.
Input
Integer m, n
Matrix[m][n]
Note : 0< m,n <100
Output
Distinct number of positional elements
Sample Testcases
I/P : 3, 3
1 2 3
4 5 6
7 8 9
O/P : 2
I/P : 3, 3
1 3 4
5 2 9
8 7 6
O/P : 7
3. Average of Two Numbers
Given two numbers, a and b. Compute the average of the two numbers.
The well know formula (a + b) / 2 may fail at the following case :
If, a = b = (2^31) – 1; i.e. INT_MAX.
Now, (a+b) will cause overflow and hence formula (a + b) / 2 wont work
4. Counting Sorts
Write a program to input an array of integers from the user and print the sorted array using counting sort.
I/P :
Length of array : 3
9 0 3
O/P :
[0, 3, 9]
5. Grouping Anagrams Together
Write a program to input a set of words and group the anagrams together.
I/P :
Enter the number of words : 6
bat, design, toc, signed, cot, tab
O/P :
The grouper anagrams are :
[‘bat’, ‘tab’]
[‘design’, ‘signed’]
[‘toc’, ‘cot’]
