👋 Hello!
Thanks for contributing on ProCodes. Before adding code for new questions/implementing new features and changes, feel free to submit an issue. We're going to talk here 😜.
If you would like to add a new code to ProCodes, fill the provided ISSUE_TEMPLATE
when creating an issue and take a look at the contributing section.
- 🍴 Fork this repository.
- 🌿 Create a new branch with the question code name. (Eg: add-SHENQ, add-ELEVATR)
- ➕ Add new codes with filename as `question_code.cpp.
- 👍 Commit your changes. Don't forget to add a commit title with an emoji
when adding new file use 📰 emoji
- 🚀 Push your changes.
- 📥 Submit your pull request.
- ✅ Complete the checklist given in the pull request
//question link: https://www.codechef.com/SEPT20B/problems/TREE2
//authorID: hayattamboli
// Example Input
// 1
// 3
// 1 2 3
// Example Output
// 3
#include <bits/stdc++.h>
using namespace std;
.
. //some code
.
void solve()
{
int n;
si(n);
set <ll> s1;
// insert all numbers in a set
lo(n)
{
ll num;
sl(num);
// dont count 0
if(num==0)
continue;
s1.insert(num);
}
// print all unique entries
cout<<s1.size()<<endl;
}
//driver function
int main() {
ll int t;
sl(t);
while(t--)
solve();
return 0;
}