All questions can be found here : https://www.desiqna.in/769/upgrade-ninja-offer-digital-information-sample-questions?show=769#q769
Solution 1
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ll n ;
cin>>n ;
vector <ll> a ;
ll i = 0 ;
while(i<n)
{
ll x ;
cin>>x;
a.push_back(x); i++;
}
ll k ;
cin>>k ;
sort(a.begin(),a.end());
cout<<a[k-1];
return 0;
}
Solution 2
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ll n ;
cin>>n ;
if(n<0)
{
cout<<"Wrong Input";
}
else
{
ll bad = 0 ;
ll g = n*n ;
string s1 = to_string(n);
string s2 = to_string(g);
ll o = s1.size();
ll i1 = o-1;
ll j1 = s2.size();
j1--;
while(i1>=0)
{
if(s1[i1]==s2[j1])
{
}
else
{
bad = 1;
}
j1--;
i1--;
}
if(bad==0)
{
cout<<"Correct Number";
}
else
{
cout<<"Incorrect Number";
}
}
return 0;
}
Solution 3 :
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
string s ;
cin>>s;
ll g = int(s[0]);
if(g>=97 && g<=122)
{
cout<<"lower alphabet";
}
else if(g>=65 && g<=90)
{
cout<<"UPPER ALPHABET";
}
else if(g>=48 && g<=57)
{
cout<<"Number";
}
else
{
cout<<"Symbol";
}
return 0;
}