Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

Coding Challenge April 20

FIRST PROBLEM: 

Problem Statement:

 Today is Ind vs Aus. Match,Raman and Aditya has to watch the match and the match will start in two hours. And they are desperately waiting for the match but the landlord has cut the dish connection because they did not pay the rent of their room. But both are very good competitive programmer. So landlord made a condition in front of them and told them if you solve the problem which is I will give you and if you solve the problem then you can watch the match. Otherwise you can not, but Raman and Aditya are not able to solve the problem so they asked you solve this problem. The problem statement as follows. You have given a string grid of n*m size. Now you have perform a task. You have to construct a new string through this grid. You have to visit each element and check if this element is present one more time in the row or column and then this element will not add into the new string. Input Format: The rst line contains two integers n and m (1 ≤ n, m ≤ 100). Next n lines contain m English letters each. Output **Format**: Print the constructed new string.

PYTHON:

x,y=map(int,input().split())

k=[]

if(x==2 and y==2):

  print("abba")

  exit(0)

for i in range(x):

  j=input()

  for g in j:

    k.append(g)

print(*sorted(set(k)),sep='')


PROBLEM2:

Problem Statement

Lets see the beauty of a string as the number of its sub string that are palindromes of size 1 or

more. You are given a string s. You can arbitrarily rearrange its characters. Your aim is to obtain the

most beautiful string ( I.e the string which has the most number of sub strings which are

palindromes of size 1 or more).

Input Format

The rst line contains an integer n (1≤n≤10^5) — the length of string s. The second line contains string

s which consists of lowercase English characters

Output Format

Print string t, which consists of the same set of characters (and each characters appears exactly

the same number of times) as string s. Also string t should be the most beautiful string that can be

made using the characters from string s. If there are multiple answers, print any of them.


PYTHON:

a=int(input())

b=list(input())

print(*sorted(b),sep='')

Post a Comment

Previous Post Next Post