Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Code 360 contest

Beginner Contest 70 (Ended)

Practice to see your potential score among the contestants
Contest details
Leaderboard
Rewards
Rules & FAQs
Discussion
Contest details

Who Can Participate:

code360 is organizing this coding contest for beginner coders and is open to programmers from all across the globe. Everyone from freshers to professionals can participate.


About The Contest:

code360 contest is our weekly coding competition. In this contest, the coders compete while also improving their overall algorithmic knowledge. The coding contest helps students and professionals tackle a problem by reading the concepts one doesn’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 code360.

 

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

Contest leaderboard
1
st
profile
Adarsh Agrawal
164
2
nd
profile
Alex Wice
160
3
rd
profile
Devansh Singhal
160
4
th
profile
Satyam Yadav
120
5
th
profile
Naveen Arumugam
80
inactive-left
1/2
active-left
Rewards

Rewards - Coding Ninjas Studio 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 Coding Ninjas Studio 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 parikh@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 support@codingninjas.com
For any issues and inquiries mail us at
code360@codingninjas.com

FAQs

Which browser should i prefer to use to participate in contest?

Coding Ninjas Studio Contests are best supported on the latest versions Google Chrome browsers, both on the Windows and MAC systems.

What kind of questions can i expect in Coding Ninjas Studio contests?

Mostly questions are focussed on data structures and algorithms skills. You can submit the code in C++, Java and Python.

Can I leave the test in between and continue later?

You can do that. But timer will continue and will not stop in between. When you come back you will lose the time of the test.

What if i encounter technical issues during the test?

You can email us at support@codingninjas.com . We will make sure to cater your issues.

What is the meaning of EXP?

You get EXP for successful submission on Coding Ninjas Studio. It can be within contest or other problems within Coding Ninjas Studio. It will help you increase your presence on Coding Ninjas Studio.

Can we participate in contests from mobile?

We are working on this. But currently this feature is not available.

Will I receive the results of the contest? If yes, when?

Yes. After the contest date ends, you will be able to see your rank and points received on the leaderboard. You will also get the email as well.

Will I get the allotted time to attempt the contest if I start the contest just few mins before the event End Time?

No, you will not be allowed to attempt any of the problems after event end time. Test will end automatically at the End Time of Event.
Discussion
Go to discussion page
profile
Codestudio
Beginner Contest 70
Contests and hackathons
views
131
views
chat
1
replies
upvote
0
upvotes

Hey Ninjas!

This is a post to ask doubts and share your logic for solving questions from Beginner Contest 70! 😄
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
0 Upvoted
Published on 2 Oct, 2024
Replies (1)
profile
Devansh Singhal
2 Oct, 2024

Looks like solution to Q4 (given in hints & solutions) is wrong. 

The given solution: 

/*
    Time Complexity: O(NlogN).
    Space Complexity: O(N).

    Where 'N' is the number of containers.
*/

long long maxEffectiveness(int n, vector<int> a){
    
    // Create a list pair of integers 'W'.
    vector<pair<int, int>> w;
    
    // For 'i' in the range '0' to 'N - 1':
    for (int i = 0; i < n; i++) {

        // Add pairs '{A[i] - i, i}' to the list 'W'.
        w.push_back({a[i] - i, i});
    }

    // Sort the array 'W'.
    sort(w.begin(), w.end());

    // Initialize the integer variable 'answer' with '0'.
    long long answer = 0;   

    // Create a priority queue 'Q'.
    priority_queue<int> q;

    // For 'i' in the range '0' to 'N - 1':
    for (int i = 0; i < n; i++) {

        // If 'W[i-1].first' is equal to 'W[i].first', then add 'A[W[i].second]' to the 'Q'.
        if (i > 0 && w[i - 1].first == w[i].first) {
            q.push(a[w[i].second]);
        } 
        else {

            // While the size of 'Q' is greater than '0':
            while (q.size() > 1) {

                // Initialize the integer variable 'sum' with the top element of the 'Q'.
                int sum = q.top(); 

                // Remove the top element of the 'Q'.
                q.pop();

                // Add the top element of the 'Q' to the 'sum'.
                sum += q.top(); 
                
                // Remove the top element of the 'Q'.
                q.pop();

                // If 'sum' is greater than '0', then add 'sum' to the 'answer'.
                if (sum > 0) {
                    answer += sum;
                }

                // If the 'size of 'Q' is equal to '1', then remove the top element of the 'Q'.
                if (q.size() == 1) {
                    q.pop();  
                }
            }
            
            // Add 'A[W[i].second]' to the 'Q'.
            q.push(a[w[i].second]);
        }
    }

    // While the size of 'Q' is greater than '0':
    while (q.size() > 1) {

        // Initialize the integer variable 'sum' with the top element of the 'Q'.
        int sum = q.top(); 

        // Remove the top element of the 'Q'.
        q.pop();

        // Add the top element of the 'Q' to the 'sum'.
        sum += q.top(); 
        
        // Remove the top element of the 'Q'.
        q.pop();

        // If 'sum' is greater than '0', then add 'sum' to the 'answer'.
        if (sum > 0) {
            answer += sum;
        }

        // If the 'size of 'Q' is equal to '1', then remove the top element of the 'Q'.
        if (q.size() == 1) {
            q.pop();  
        }
    }


    // Return 'answer'.
    return answer;
}

 

The test case:

1
4
6 7 8 2

should give answer 15 (= 7+8), but its considering 6 and 2 too thus showing answer as 23.

chat
0
replies
upvote
upvotes
reply
Reply