#### Category : cp Challenge Date: 24/7/21 Looking for an Approach Source: Windows Que..

This was an "easy" leetcode problem to return the number of remaining elements after removing duplicate elements from a sorted set of elements. My code seemed to be removing the last element and its copies altogether and I have not been able to find out why. Can someone please explain/debug? Your input [0,0,1,1,1,2,2,3,3,4] Output [0,1,2,3] ..

I am a beginner in programming and trying to solve problems from the Australian Informatics Olympiad. I am stuck on this problem even though to me it seems very simple and straight-forward. Here’s the link to the problem: AIO 2020 – Baubles Below is the snippet of my code that only scored 15%: void solve(){ ..

I want to compute Kth Smallest Element of of A[i]+A[j] (1<i<j<n), but I am getting memory limit exceed for this given problem , how can I overcome this ? Input: The first line of the input contains – the size of the array and . Second-line integers elemnets of array #include<bits/stdc++.h> using namespace std; #define ..

I want the reduce the time complexity of this code. Input format The first line contains an integer denoting the number of elements in array and . The second line contains space-separated integers denoting the array . The last line contains space-separated integers denoting the array. Inputs and outputs are as given below. Input 5 ..

https://www.hackerrank.com/challenges/balanced-brackets/problem This is the question link and here is my code : #include <bits/stdc++.h> using namespace std; // Complete the isBalanced function below. string isBalanced(string s) { stack<char> st; for(int i=0;i<(int)s.size();i++) { switch(s[i]) { case ‘(‘ : case ‘{‘ : case ‘[‘ : st.push(s[i]); break; case ‘)’ : **if(st.top()!='(‘ || st.empty())** { return "NO"; } ..

Following is the code which is running as expected in local ide but when i am submitingh the code in codeforces it is displaying that the outputs are wrong.Question is enter link description heredense array #include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t–) { std::vector<int> my; int x,i,a,j,bno,sno; cin>>x;//enter number of elements ..