Code Gladiators 2020 Solutions With Explanation

Recommended: Please try your approach on your own first, before moving on to the solution.

Que 1: The Power puff Girls for full problem statement click_here

Solution: Since it is asked to print the number of maximum powerpuff girls that can be made from the available ingredients .

Our approach is like we : we run a for loop from 0 to n and divide the available array elements with required array elements and then we calculate the minimum element of that resulting array , at last we just print the minimum value.

Complexity: O(n)

Language: JAVA

import java.util.*;
public class CandidateCode {
    public static void main(String args[] ) throws Exception {

     Scanner inp =new Scanner(;
        Long n=inp.nextLong();
        Long arr[]=new Long [Math.toIntExact(n)];//requed array
        for(int i=0;i<n;i++){
        Long arr2[]=new Long[Math.toIntExact(n)];// Avl array
        for (int j=0;j<n;j++){

            for(int j=0;j<n;j++){



       Long MIN = Long.valueOf(110000);
        for(int i=0;i<n;i++){



Also Read: How To Make Telegram BOT with Python

Que #2: Beyblade World Championship Full Problem Statement


Complexity: O(n)

Language : Python 3

Objective : 

	To get total count of wins can team-G Revolution get by shuffling its player's
order by considering opposite team. We can only shuffle order of team-G revolution players to find
a optimal solution.

Approach used :

for each test case : 
	1.Saving powers of both teams in two different lists.
	2.Sort both lists in reverse(descending) order.
	3.Compare powers of both players : if power of team-G revolution player is greater than opposite
	  player, consider it as win and increase count of win by 1.

def main():

 n = int(input()) 				#for taking number of test cases
 for i in range(n):				#for loop for each test case
    k=0						#stores total win count in each test case
    m = int(input())				#number of members each team can have
    pow_g = list(map(int,input().split()))	#list stores space separated powers of Team-G Revolution players
    pow_o = list(map(int,input().split())) 	#list stores space separated powers of opposite team
    pow_g.sort(reverse=True)			#sort team-G Revolution powers in reverse order
    pow_o.sort(reverse=True)			#sort opposite teams power in reverse order
    c = 0					
    for i in range(m):				#outer for loop to compare powers
        for j in range(c,m):			#inner for loop to compare powers
            if pow_g[i] > pow_o[j]:		#compare powers of current members both teams
                c = j + 1			
                k+=1				#increase win count by 1
                break				#break loop
    print(k)					#print max possible wins of team-G Revolution for each test case 


Hope this helps?

For Coding Related Stuff Join Us On Telegram : CLICK HERE TO JOIN

We assure, you won’t regret!

Also Read: How To Make Telegram BOT with Python

Best Headphones Under 2000 May 2020

Fallout 4 Gamescom Leaked Video Uploaded on PornHub

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: