MCCP-1 Record
MCCP-1 Record
PEDATADEPALLI, TADEPALLIGUDEM.
LEETCODE PROFILE:
MATHEMATICAL PROBLEMS
1. Union of two arrays
Given a natural number N, the task is to find the sum of the divisors of all the divisors of N.
1. A Special Keyboard
Imagine you have a special keyboard with all keys in a single row. The layout of characters on a
keyboard is denoted by a string S1 of length 26. S1 is indexed from 0 to 25. Initially, your finger is
atindex0.To type a character, you have to move your finger to the index of the desired character.
The time taken to move your finger from index i to index j is |j-i|, where || denotes absolute value.
Find the time taken to type the string S2 with the given keyboard layout.
4. Valid Expression
Given a string S, composed of different combinations of '(' , ')', '{', '}', '[', ']'. The task is to verify the
validity of the arrangement. An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. 2. Open brackets must be closed in the correct order.
5. Wrong Ball
There is a table on which N balls are kept starting from index 1 to N in horizontal direction.
Each ball is either of red (denoted by 'R') or of blue (denoted by 'B') color. Any red ball which
is placed on even indices and blue balls placed on odd indices is considered as wrongly placed.
You need return the number of balls placed wrong on the table.
PROBLEMS ON PRIMES
2. Damon Prime
Damon is a mathematician. He will give you an integer N, you need to find whether the number is
Damon Prime or not.
For example: 4 is a damon prime, 5 is not a damon prime, 102 is a damon prime, 9 is not a damon
prime, etc .
3. Primes sum
Given a number N. Find if it can be expressed as sum of two prime numbers.
4. Sum of primes
Your task is to calculate sum of primes present as digits of given number N.
5. Twisted Prime Number
Given a number N. Check whether N is a Twisted Prime number or not.
Note: A number is called Twisted Prime if it is a prime and its reverse is also a prime.