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
⭐️Infosys sending interview mail and rejection mail.
TG https://t.me/Coding_human
TG 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
TCS REASONING
1)113
2)222
3)14
4)607
5)42
6)624
7)VD
8)MN
9)i
10)Social
11)prose
12)brown
13)her case - general manager
14)A,B & C only
15) brother in law
✅Telegram- https://t.me/Coding_human
Loot deals : https://t.me/DMAD_Discussion
1)113
2)222
3)14
4)607
5)42
6)624
7)VD
8)MN
9)i
10)Social
11)prose
12)brown
13)her case - general manager
14)A,B & C only
15) brother in law
✅Telegram- https://t.me/Coding_human
Loot deals : https://t.me/DMAD_Discussion
Tcs IRA JAVA:
1.)All of the Above
2.)Volume,velocity,variety
,veracity
3.)veracity.
4.)True
5.)50
6.)offering others.....productivity.
7.)white socks are seen....
8.Trap of assumptions
9.)cluster all products....
10.)The project proposals should be...
11.)C.)Tata consultancy services ...
12.)Error
13.)....Begin and end blocks
14.)grep myempid""FuncName"*
15.)
16.)alter table employee alter assets int
17.)check
18.)False
19.)
Amazon/FK offers : https://t.me/DMAD_Discussion
Telegram - https://t.me/Coding_human
Discussion(Coding Help) : https://t.me/infosys_accolite_all_slots_exam
1.)All of the Above
2.)Volume,velocity,variety
,veracity
3.)veracity.
4.)True
5.)50
6.)offering others.....productivity.
7.)white socks are seen....
8.Trap of assumptions
9.)cluster all products....
10.)The project proposals should be...
11.)C.)Tata consultancy services ...
12.)Error
13.)....Begin and end blocks
14.)grep myempid""FuncName"*
15.)
16.)alter table employee alter assets int
17.)check
18.)False
19.)
Amazon/FK offers : https://t.me/DMAD_Discussion
Telegram - https://t.me/Coding_human
Discussion(Coding Help) : https://t.me/infosys_accolite_all_slots_exam
PYTHON
1.Robotics
2.True
3.all of the above
4. Value
5. Inexpensive
6. D
7. B
8. B&D
9. B
10. D
36.Error
37. n
41.5
43.HELLO
44.[76,54,99]
45.Error
46. {3,a}
47. B
48. A
49. 1
50. 3210
https://t.me/Coding_human
https://t.me/DMAD_Discussion
https://t.me/infosys_accolite_all_slots_exam
1.Robotics
2.True
3.all of the above
4. Value
5. Inexpensive
6. D
7. B
8. B&D
9. B
10. D
36.Error
37. n
41.5
43.HELLO
44.[76,54,99]
45.Error
46. {3,a}
47. B
48. A
49. 1
50. 3210
https://t.me/Coding_human
https://t.me/DMAD_Discussion
https://t.me/infosys_accolite_all_slots_exam
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
C++👆
def authentication (n):
A=list(range(1,n+1))
i=2
While i<len(A):
A= A[j for j in range(len(A)) if j%i !=0]
i+=1
return ("Yes" if len(A)>0 else "No")
print(authentication(int(input()))
Python3
strong number code
Telegram -https://t.me/Coding_human
https://t.me/DMAD_Discussion
def authentication (n):
A=list(range(1,n+1))
i=2
While i<len(A):
A= A[j for j in range(len(A)) if j%i !=0]
i+=1
return ("Yes" if len(A)>0 else "No")
print(authentication(int(input()))
Python3
strong number code
Telegram -https://t.me/Coding_human
https://t.me/DMAD_Discussion
Increase a Array in one element
C++ Language
Tg : https://t.me/Coding_human
https://t.me/tata_elxsi_exam_mindtree_help
https://t.me/DMAD_Discussion
C++ Language
Tg : https://t.me/Coding_human
https://t.me/tata_elxsi_exam_mindtree_help
https://t.me/DMAD_Discussion
Pair divisible by numbers
Telegram : https://t.me/Coding_human
https://t.me/tata_elxsi_exam_mindtree_help
https://t.me/DMAD_Discussion
Telegram : https://t.me/Coding_human
https://t.me/tata_elxsi_exam_mindtree_help
https://t.me/DMAD_Discussion
def compute_hcf(x, y):
if x > y:
smaller = y
else:
smaller = x
for i in range(1, smaller+1):
if((x % i == 0) and (y % i == 0)):
hcf = i
return hcf
num1 = 54
num2 = 24
print("The H.C.F. is", compute_hcf(num1, num2))
Telegram👇
@Coding_human
@Coding_human
@Coding_human
@tata_elxsi_exam_mindtree_help
@DMAD_Discussion
if x > y:
smaller = y
else:
smaller = x
for i in range(1, smaller+1):
if((x % i == 0) and (y % i == 0)):
hcf = i
return hcf
num1 = 54
num2 = 24
print("The H.C.F. is", compute_hcf(num1, num2))
Telegram👇
@Coding_human
@Coding_human
@Coding_human
@tata_elxsi_exam_mindtree_help
@DMAD_Discussion
def extractSecretMessage(Str, Sub): Str= Str.replace(Sub, " ") return Str.strip() Str = input("") Sub = input("") print(extractSecretMessage(Str, Sub))
Fanny occurrences code
Python
✅Telegram- @Coding_human
@tata_elxsi_exam_mindtree_help
@DMAD_Discussion
@Coding_human
Fanny occurrences code
Python
✅Telegram- @Coding_human
@tata_elxsi_exam_mindtree_help
@DMAD_Discussion
@Coding_human