Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HimaniNainwal.cpp #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions DSA Marathon/Day 1/Solution/HimaniNainwal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include<iostream>
using namespace std;
int main()
{
int T; // test cases
int N; //denoting size of nums array.
cout<<"Enter number of test cases : ";
cin>>T;
while(T>=1)
{
cout<<"Enter size of nums array : ";
cin>>N;
int nums[N+1];
cout<<"Enter inputs : ";
for(int i=1;i<=N+1;i++)
{
cin>>nums[i];
}
for(int j=1;j<=N+1;j++)
{
for(int k=j+1;k<=N+1;k++)
{
if(nums[j]==nums[k])
{
cout<<"Output : "<<nums[j]<<endl;
break;
}
}

}
T--;
}
return 0;
}
22 changes: 22 additions & 0 deletions DSA Marathon/Day 2/Solution/day2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from array import *
t=int(input("Enter the no. of test cases : "))
while t>=1:
t=t-1
A = array('i',[])
s=int(input("Enter the array size : "))
print("Enter the array elements : ")
for i in range(s):
x=int(input())
A.append(x)
a=int(input("Enter the element whose index to be searched : "))
for q in A:
if q==a:
print(A.index(a))
break
elif q==s:
print("-1")
break