Update appNew update is available. Click here to update.
Codestudio contest
lightning-red
Rated
Codestudio Weekend Contest 66
+8250 Other showed interest
Contest ended
25-Mar-23
(2:30 PM IST)
Your rating & Leaderboard
Discussion
Contest details
Rewards
Rules & FAQs
Login to view weekend contest rating
Contest leaderboard
1st
Ankit Kumar
320
2nd
Chiya Ujimatsu
320
3rd
Shreya Anand
261
4th
Jaskaran
261
5th
Vatsal Agarwal
261
inactive-left
1/2
active-left
Discussion
Go to discussion page
Codestudio
Codestudio Weekend Contest 66
Contests and hackathons
views
905
views
chat
11
replies
upvote
2
upvotes

Hey Ninjas!

This is a post to ask doubts and share your logic for solving questions from Codestudio Weekend Contest 66! 😄
You can also view the rankings for the contest here (link).

If you face any issues during the contest, do let us know by replying below. ✌️

How was your experience in the contest or got any feedback? Let us know here (link)

upvote
2 Upvoted
Published on 25 Mar, 2023
Replies (11)
SANDEEP GUPTA
25 Mar, 2023

I have solved the second question without TLE here is my solution - 

vector<int> isNinjaAlive(int n, int k, int q, vector<int>& shield){
	
	vector<int> ans(n,k-q);

	for(int i=0;i<shield.size();i++){
		if(shield[i]>0)ans[shield[i]-1] += 1;
    }

	vector<int> res(n,0);

	for(int i=0;i<n;i++){
		if(ans[i]>0) res[i] = 1;
	}

	return res;
}
chat
2
replies
upvote
3
upvotes
reply
Reply
Sourav Sen
25 Mar, 2023

So this is how I solved B. This gives AC for 10/11 test cases and probably gives TLE for the last TC.

 

 int[] ninja=new int[n];
        Arrays.fill(ninja,k);
        int j=0;
        while(q-->0)
        {
           int ind=shield[j]-1;
           for(int i=0;i<n;i++)
           {
               if(i!=ind)
               {
                
                   ninja[i]--;
               }
           }
           j++;
        }
        int[] ans=new int[n];
        for(int i=0;i<n;i++)
        ans[i]=ninja[i]>0?1:0;
        return ans;

  As per the problem we need to iterate through every index of shields[] and decrease the value of every index in the ninja[] array by 1, except the index pointed to by shields[i]. Can anyone please share their AC code as how to solve this in T.C less than the T.C of my code. Was thinking of trying out a few other methods involving strings ,etc to somehow pass the time limit but couldn't implement it as I started the contest very late (with only 20 minutes remaining). Thanks.

 

chat
3
replies
upvote
1
upvotes
reply
Reply
Kirti Gahlot
27 Mar, 2023

Join Striver's tutorial, where he walks through the solutions to each problem of Codestudio Weekend Contest 66 | 25 Mar, 2023.

 

So what are you waiting for? Put your coding skills to the test and join Striver for a weekend of problem-solving here! 💻👨‍💻

chat
0
replies
upvote
1
upvotes
reply
Reply
Aniruddh Singh
25 Mar, 2023

I was not able to pass the last test case of third question …

What i understood is that if between any 2 answers eg 001 and 110 .. if the no of different answers is divisible by 2 so they would share same rank for some or the other combination of answers…Hence if the no of different answers is odd then they would never share same rank for any combination of ans

[no of different ans = sum of instances where both answer doesnt match (eg 1 & 0 or 0 & 1) of two ninjas)]

 

Can anyone tell what was wrong that i passed only 10/11 test cases…or atleast share your solution

Here is my code

public class Solution {
    static long findPairs(int n, int m, int [][]response) {
  

        int cnt = 0;

        for(int i = 0;i<n;i++)
        {
           for(int j = i+1;j<n;j++)
           {
               int diff = 0;
               for(int k = 0;k<m;k++)
               {
                   if(response[i][k]!=response[j][k])diff++;
               }
               if(diff%2!=0)cnt++;
           }
        }
        return cnt;

    }
}
chat
0
replies
upvote
1
upvotes
reply
Reply
Sou3105
25 Mar, 2023

Hey, I was able to solve the first 2 questions !! First one was easy though but the second one was throwing TLE.  After Thinking a while i was able to reduce the Time-complexity to O(n). Slow start but yeah looking forward to participate and able to solve more and more questions. Cheers ! 

chat
0
replies
upvote
upvotes
reply
Reply
Contest details
Total problems
4
Total EXPs
spark
320
Start time
25-Mar-23
(01:00 PM CUT)
End time
25-Mar-23
(02:30 PM CUT)
Duration:
1 hour 30 mins

Who Can Participate:

CodeStudio weekend coding contests are open to programmers from all across the globe. Everyone, from freshers to professionals, can participate.


About The Contest:

CodeStudio Contest is our weekend coding competition. In this contest, the coders compete while also improving their overall algorithmic knowledge. The coding contest helps students and professionals to tackle a problem by reading the concepts they don’t know and also gain practical experience by coding the solution to the problem, thus improving their skills significantly. This coding competition packs the excitement of programming with the fun of learning into one compelling challenge. Don't forget to try out a sample problem if you are new to Codestudio.

 

Duration Of The Programming Contest: 1.5 hours (90 mins)

Sample problem for you
Rewards

Rewards - CodeStudio EXP

  • 1st - 1000
  • 2nd - 750
  • 3rd - 500
  • 4th-10th - 250
  • 11th-50th - 100
  • First Contest - 200
  • Participation - 100
Rules
  • You can submit solutions as many times as you'd like, there are no penalties for incorrect submissions. Only your best correct submission will be considered.
  • Those who achieve the score first will be placed higher in the ranklist in case of a tie.
  • Discussing Codestudio contest problems or any aspect of the problem, on any other platform on the web, on identification, could lead to disabling of respective account and banning from the community.
  • Please do not discuss strategy, suggestions, or tips in the comments during a live contest. Posting questions clarifying the problem statement is ok. If you are unsure, feel free email us at codestudio@codingninjas.com
  • The problems will be partially graded. You will get score for passing certain test cases.
  • Facing any kind of issues, email us at codestudio@codingninjas.com
For any issues and inquiries mail us at
support@codingninjas.com
FAQs
Which browser should I prefer to use to participate in contests?
What kind of questions can I expect in CodeStudio contests?
Can I leave the test in the middle and continue later?
What if i encounter technical issues during the test?
What is the meaning of EXP?
Can we participate in contests from mobile?
Will I receive the results of the contest? If yes, when?
Will I get the allotted time to attempt the contest if I start the contest just few mins before the event End Time?
up arrowGo on top