Reasoning
1)242
2)370
3)166
4)124
5)99
6) 380
7)uc
8)qf
9)ur
10)2,5 3
11)3,5,1
12.315
13 gs
14.13 j
15 father in law
https://t.me/Coding_human
1)242
2)370
3)166
4)124
5)99
6) 380
7)uc
8)qf
9)ur
10)2,5 3
11)3,5,1
12.315
13 gs
14.13 j
15 father in law
https://t.me/Coding_human
Wedding code TCS
https://t.me/Coding_human
https://t.me/Coding_human
INFOSYS & TCS NQT EXAM SOLUTION GROUP π
https://t.me/Coding_human
https://t.me/infosys_tcs_all_slots_exam
β Share post in ur college Whatsapp grps.
https://t.me/Coding_human
https://t.me/infosys_tcs_all_slots_exam
β Share post in ur college Whatsapp grps.
π₯Zebronics mouse and keyboard @ 299 graabb
https://amzn.to/3FV07EZ
π₯grab fast Zebronics mouse @ 92
Choose other seller
https://amzn.to/3nUVZPi
Join @DMAD_Discussion
https://amzn.to/3FV07EZ
π₯grab fast Zebronics mouse @ 92
Choose other seller
https://amzn.to/3nUVZPi
Join @DMAD_Discussion
Infosys result will be declared on 30th Jan.
Good luckπ
Good luckπ
Some important interview questions
I gave tr1
Joins in dbms
Difference between primary and unique key, primary and foreign key
Constraints in dbms
What is union and union all
Group by and order by clause
Difference between array and collection
Difference between switch and if
Oops concept
I gave tr1
Joins in dbms
Difference between primary and unique key, primary and foreign key
Constraints in dbms
What is union and union all
Group by and order by clause
Difference between array and collection
Difference between switch and if
Oops concept
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] array = new int[6];
int max = 0;
for (int i = 0; i < array.length; i++) {
array[i] = in.nextInt();
if (array[max] < array[i]) {
max = i;
}
}
int cities = in.nextInt();
System.out.println(max);
}
}
Java
ALT TAB Window Code
Telegram - https://t.me/Coding_human
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] array = new int[6];
int max = 0;
for (int i = 0; i < array.length; i++) {
array[i] = in.nextInt();
if (array[max] < array[i]) {
max = i;
}
}
int cities = in.nextInt();
System.out.println(max);
}
}
Java
ALT TAB Window Code
Telegram - https://t.me/Coding_human
Important notice guyzz
Stay away from Rippers
Don't pay anything to anybody.
We provide free material always.
Kisi Ko kuch bhi amount pay mat krnaa π
βΊοΈβ€οΈ
Stay away from Rippers
Don't pay anything to anybody.
We provide free material always.
Kisi Ko kuch bhi amount pay mat krnaa π
βΊοΈβ€οΈ
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System .in));
int t=Integer.parseInt(br.readLine());
while(t-->0)
{
int n=Integer.parseInt(br.readLine());
String[] num_str=br.readLine().split(" ");
int[] num=new int[n];
int i;
for(i=0;i<n;i++)
{
num[i]=Integer.parseInt(num_str[i]);
}
@Coding_human
int pos=0;
int count=0;
if(n!=1)
{
while(true)
{
int step=num[pos];
int max=-1;
int max_ind=-1;
int limit;
if(step>n-pos-1)
{
count++;
break;
}
for(i=pos+1;i<=pos+step;i++)
{
if(max<num[i])
{
max=num[i];
max_ind=i;
}
}
//System.out.println("-"+max);
pos=max_ind;
count++;
}
}
else
{
count++;
}
System.out.println(count);
}
}
}
Java
β Energy drink code
πTelegram - https://t.me/Coding_human
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System .in));
int t=Integer.parseInt(br.readLine());
while(t-->0)
{
int n=Integer.parseInt(br.readLine());
String[] num_str=br.readLine().split(" ");
int[] num=new int[n];
int i;
for(i=0;i<n;i++)
{
num[i]=Integer.parseInt(num_str[i]);
}
@Coding_human
int pos=0;
int count=0;
if(n!=1)
{
while(true)
{
int step=num[pos];
int max=-1;
int max_ind=-1;
int limit;
if(step>n-pos-1)
{
count++;
break;
}
for(i=pos+1;i<=pos+step;i++)
{
if(max<num[i])
{
max=num[i];
max_ind=i;
}
}
//System.out.println("-"+max);
pos=max_ind;
count++;
}
}
else
{
count++;
}
System.out.println(count);
}
}
}
Java
β Energy drink code
πTelegram - https://t.me/Coding_human
#include<stdio.h>
#include<math.h>
int isPerfectSquare(int number)
{
int iVar;
float fVar;
fVar=pow(number,1.0/3.0);
iVar=(int)fVar;
if(iVar==fVar)
return number;
else
return 0;
}
@Coding_human
int main()
{
int n;
scanf(β%dβ,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
int count = 0;
for(i = 0; i < n; i++)
{
if(isPerfectSquare(arr[i]))
count++;
}
printf("%d",count);
return 0;
}
E-Commerce
Telegram - https://t.me/Coding_human
#include<math.h>
int isPerfectSquare(int number)
{
int iVar;
float fVar;
fVar=pow(number,1.0/3.0);
iVar=(int)fVar;
if(iVar==fVar)
return number;
else
return 0;
}
@Coding_human
int main()
{
int n;
scanf(β%dβ,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
int count = 0;
for(i = 0; i < n; i++)
{
if(isPerfectSquare(arr[i]))
count++;
}
printf("%d",count);
return 0;
}
E-Commerce
Telegram - https://t.me/Coding_human
def bfs(graph,c,t):
s=1
n=len(graph)-1
dist=[]
pred=[]
color=[]
q=[]
count=0
for _ in range(len(graph)):
dist.append(9999)
pred.append(None)
color.append('w')
q.append(s)
dist[s]=0
color[s]='g'
while len(q)!=0:
u=q.pop(0)
if u==n:
break
count+=1
color[u]='b'
for i in graph[u]:
if color[i]=='w':
q.append(i)
color[i]='g'
dist[i]=dist[u]+c
pred[i]=u
return dist[n]
n,m,t,c=map(int,input().split())
graph=[[] for _ in range(n+1)]
for _ in range(m):
x,y=map(int,input().split())
graph[x].append(y)
graph[y].append(x)
time=bfs(graph,c,t)
signal='g'
signals=[None]
for _ in range(t):
signals.append('g')
for i in range(t,time+1):
if i==0:
continue
if (i//t)%2==0:
signals.append('g')
else:
signals.append('r')
for i in range(0,time,c):
if signals[i]=='r':
time+=(signals[i+1:].index('g'))
print(time)
Python accolite beautiful path
Tg : https://t.me/Coding_human
s=1
n=len(graph)-1
dist=[]
pred=[]
color=[]
q=[]
count=0
for _ in range(len(graph)):
dist.append(9999)
pred.append(None)
color.append('w')
q.append(s)
dist[s]=0
color[s]='g'
while len(q)!=0:
u=q.pop(0)
if u==n:
break
count+=1
color[u]='b'
for i in graph[u]:
if color[i]=='w':
q.append(i)
color[i]='g'
dist[i]=dist[u]+c
pred[i]=u
return dist[n]
n,m,t,c=map(int,input().split())
graph=[[] for _ in range(n+1)]
for _ in range(m):
x,y=map(int,input().split())
graph[x].append(y)
graph[y].append(x)
time=bfs(graph,c,t)
signal='g'
signals=[None]
for _ in range(t):
signals.append('g')
for i in range(t,time+1):
if i==0:
continue
if (i//t)%2==0:
signals.append('g')
else:
signals.append('r')
for i in range(0,time,c):
if signals[i]=='r':
time+=(signals[i+1:].index('g'))
print(time)
Python accolite beautiful path
Tg : https://t.me/Coding_human
def check(a,n)
if n==1:
return 1
a.sort()
c=0
i=0
while(i<n-1):
if a[i+1]-a[i]==1:
i=i+2
c=c+1
else:
i=i+1
if c:
return c
else:
return 1
n=int(input())
@Coding_human
a=[]
for i in range(n):
a.append(int(input()))
print(check(a,n))
Python
Whales code
Telegram - https://t.me/Coding_human
if n==1:
return 1
a.sort()
c=0
i=0
while(i<n-1):
if a[i+1]-a[i]==1:
i=i+2
c=c+1
else:
i=i+1
if c:
return c
else:
return 1
n=int(input())
@Coding_human
a=[]
for i in range(n):
a.append(int(input()))
print(check(a,n))
Python
Whales code
Telegram - https://t.me/Coding_human
#include <iostream>
using namespace std;
// Function to find and print pair
bool chkPair(int A[], int size, int x) {
for (int i = 0; i < (size - 1); i++) {
for (int j = (i + 1); j < size; j++) {
if (A[i] + A[j] == x) {
cout << "Pair with a given sum " << x << " is (" << A[i] << ", " << A[j] << ")"
<< endl;
return 1;
}
}
}
return 0;
}
@Coding_human
int main(void) {
int A[] = {0, -1, 2, -3, 1};
int x = -2;
int size = sizeof(A) / sizeof(A[0]);
if (chkPair(A, size, x)) {
cout << "Valid pair exists" << endl;
}
else {
cout << "No valid pair exists for " << x << endl;
}
return 0;
}
C++
This C++ program tells if there exists a pair in array whose sum results in x.
Telegram - https://t.me/Coding_human
def minOps(A, B):
m = len(A)
n = len(B)
# This part checks whether conversion is possible or not
if n != m:
return -1
count = [0] * 256
for i in range(n): # count characters in A
count[ord(B[i])] += 1
for i in range(n): # subtract count for every char in B
count[ord(A[i])] -= 1
for i in range(256): # Check if all counts become 0
if count[i]:
return -1
# This part calculates the number of operations required
res = 0
i = n-1
j = n-1
while i >= 0:
# if there is a mismatch, then keep incrementing
# result 'res' until B[j] is not found in A[0..i]
while i>= 0 and A[i] != B[j]:
i -= 1
res += 1
# if A[i] and B[j] match
if i >= 0:
i -= 1
j -= 1
return res
# Driver program
A = "EACBD"
B = "EABCD"
print ("Minimum number of operations required is " + str(minOps(A,B)))
Python
Minimum number of operations required Code
Telegram - https://t.me/Coding_human
m = len(A)
n = len(B)
# This part checks whether conversion is possible or not
if n != m:
return -1
count = [0] * 256
for i in range(n): # count characters in A
count[ord(B[i])] += 1
for i in range(n): # subtract count for every char in B
count[ord(A[i])] -= 1
for i in range(256): # Check if all counts become 0
if count[i]:
return -1
# This part calculates the number of operations required
res = 0
i = n-1
j = n-1
while i >= 0:
# if there is a mismatch, then keep incrementing
# result 'res' until B[j] is not found in A[0..i]
while i>= 0 and A[i] != B[j]:
i -= 1
res += 1
# if A[i] and B[j] match
if i >= 0:
i -= 1
j -= 1
return res
# Driver program
A = "EACBD"
B = "EABCD"
print ("Minimum number of operations required is " + str(minOps(A,B)))
Python
Minimum number of operations required Code
Telegram - https://t.me/Coding_human