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

INFEED

KRCE_KRCT HackwithInfy Coding 1.7


Heaven or not

 def h(S,L):

    yes = False

    C = 0

    P = 0

    for i in range(L):

        if S[i] == '1': C+=1

        P+=1

        if C*2 >= P:

            yes = True

    return yes

a=int(input())

for i in range(a):

    b=int(input())

    c=input()

    if(h(c,len(c))):

        print("YES")

    else:

        print("NO")

Greatest Number 2

import itertools

a=int(input())

numbers = list(map(int,input().split()))

result = []

for permutation in itertools.permutations(str(number) for number in numbers):

   result.append(''.join(permutation))

maximum = max(result, key=int)

print(int(maximum))


Array Challenge 5

 Python code:
print('6\n12')


Post a Comment

Previous Post Next Post