QUESTION DESCRIPTION
There are K tiles. Each of the tiles either contains a single uppercase Latin letter or is a blank tile meaning that it can represent any uppercase Latin letter.
Given is also a graph with N nodes and M edges. Initially, some of the nodes contain tiles. The rest of the nodes are unoccupied.
Find the sequential letters in order.
There are K tiles. Each of the tiles either contains a single uppercase Latin letter or is a blank tile meaning that it can represent any uppercase Latin letter.
Given is also a graph with N nodes and M edges. Initially, some of the nodes contain tiles. The rest of the nodes are unoccupied.
Find the sequential letters in order.
TEST CASE 1
INPUT
INPUT
3
2 1 4
1
OUTPUTSequential file
1 found at location 2
TEST CASE 2
INPUT
INPUT
6
2 1 4 5 4 7
4
OUTPUTSequential file
4 found at location 3
Code :
#include <iostream>
using namespace std;
int main() {
int a,b;
int ar[a];
cin>>a;
for(int i=0;i<a;i++)
{
cin>>ar[i];
}
cin>>b;
int j=0;
cout<<"Sequential file\n";
for(int i=0;i<a;i++)
{
if(ar[i]==b)
{
j=i;
break;
}
else
{
j=j;
}
}
cout<<b<<" found at location "<<(j+1);
return 0;
}