public class Solutions {
public static void main(String[] args){
class Bus
{
private int busNo;
private String travelsName;
private int passengerCount;
private int busStop;
public Bus(int busNo, String travelsName, int passengerCount, int busStop) {
super();
this.busNo = busNo;
this.travelsName = travelsName;
this.passengerCount = passengerCount;
this.busStop = busStop;
}
public int getBusNo() {
return busNo;
}
public void setBusNo(int busNo) {
this.busNo = busNo;
}
public String getTravelsName() {
return travelsName;
}
public void setTravelsName(String travelsName) {
this.travelsName = travelsName;
}
public int getPassengerCount() {
return passengerCount;
}
public void setPassengerCount(int passengerCount) {
this.passengerCount = passengerCount;
}
public int getBusStop() {
return busStop;
}
public void setBusStop(int busStop) {
this.busStop = busStop;
}
}
}
}
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
public static void main(String[] args){
class Bus
{
private int busNo;
private String travelsName;
private int passengerCount;
private int busStop;
public Bus(int busNo, String travelsName, int passengerCount, int busStop) {
super();
this.busNo = busNo;
this.travelsName = travelsName;
this.passengerCount = passengerCount;
this.busStop = busStop;
}
public int getBusNo() {
return busNo;
}
public void setBusNo(int busNo) {
this.busNo = busNo;
}
public String getTravelsName() {
return travelsName;
}
public void setTravelsName(String travelsName) {
this.travelsName = travelsName;
}
public int getPassengerCount() {
return passengerCount;
}
public void setPassengerCount(int passengerCount) {
this.passengerCount = passengerCount;
}
public int getBusStop() {
return busStop;
}
public void setBusStop(int busStop) {
this.busStop = busStop;
}
}
}
}
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
package com;
import java.util.Scanner;
public class ToyDemo {
public static void main(String[] args) {
Scanner s = new Scanner ( System.in);
Toy one = new Toy();
System.out.println("Enter a string");
Toy one= new one.name = in.nextLine();
Toy two = new Toy("banana","fruits",10,2);
Toy three = new Toy("dog","animal",800,50);
Toy four = new Toy("buffalo","animal",8000,250);
System.out.println(" The Toy with least price is " +
getLeastPriceToy(one, two, three, four, "animal"));
}
public static String getLeastPriceToy(Toy one,Toy two,Toy three,Toy four,String category) {
if(one.getCategory().equals(category))
Toy to = one;
if(two.getPrice()>to.getPrice())
to = two;
if(category.equals("animal"))
Toy to=three;
if(four.getPrice()>to.getPrice())
to = four;
return to.getName();
}
}
public class Toy{
private String name;
private String category;
private double price;
private double discount;
public Toy(String name, String category, double price, double discount){
this.name = name;
this.category = category;
this.price = price;
this.discount = discount;
Toy code
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
import java.util.Scanner;
public class ToyDemo {
public static void main(String[] args) {
Scanner s = new Scanner ( System.in);
Toy one = new Toy();
System.out.println("Enter a string");
Toy one= new one.name = in.nextLine();
Toy two = new Toy("banana","fruits",10,2);
Toy three = new Toy("dog","animal",800,50);
Toy four = new Toy("buffalo","animal",8000,250);
System.out.println(" The Toy with least price is " +
getLeastPriceToy(one, two, three, four, "animal"));
}
public static String getLeastPriceToy(Toy one,Toy two,Toy three,Toy four,String category) {
if(one.getCategory().equals(category))
Toy to = one;
if(two.getPrice()>to.getPrice())
to = two;
if(category.equals("animal"))
Toy to=three;
if(four.getPrice()>to.getPrice())
to = four;
return to.getName();
}
}
public class Toy{
private String name;
private String category;
private double price;
private double discount;
public Toy(String name, String category, double price, double discount){
this.name = name;
this.category = category;
this.price = price;
this.discount = discount;
Toy code
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
Forwarded from Off Campus job Updates- Placement Material
Its a fantastic News for Final Year Studentsπ, Graduatesπ¨π»βπ and people who have just started their career .
π€―β’ Pay Only When you land a JOB. Yes, You are right!! Why pay hefty amount on courses Initially ?
π»β’ A 9 Months coding bootcamp on Web Development- Learn Full Stack development, DS and Algo, System Design and work on various course projects.
π΅. An Average Package of 7.8 Lakhs offered among all the batches of career camp.
π€. A dedicated Placement support for the students with over 50 opportunities a week
πβ’ Get Your career Started in product based organisations like RazorPAy, Paytm, Snaphunt etc.
Only few seats remain!!
Register Now- https://bit.ly/3H2IUL4
Last date for the registration- 30th Jan
π€―β’ Pay Only When you land a JOB. Yes, You are right!! Why pay hefty amount on courses Initially ?
π»β’ A 9 Months coding bootcamp on Web Development- Learn Full Stack development, DS and Algo, System Design and work on various course projects.
π΅. An Average Package of 7.8 Lakhs offered among all the batches of career camp.
π€. A dedicated Placement support for the students with over 50 opportunities a week
πβ’ Get Your career Started in product based organisations like RazorPAy, Paytm, Snaphunt etc.
Only few seats remain!!
Register Now- https://bit.ly/3H2IUL4
Last date for the registration- 30th Jan
Forwarded from Off Campus job Updates- Placement Material
Daily job Updates β€οΈ
https://t.me/offcampusjobs_0
https://t.me/offcampusjobs_0
Telegram
Off Campus job Updates- Placement Material
500+ Placement & Competitive Exam Materials
75+ Companies Materials
100+ JOB Updates in a Month
πDM for Promotion @Wren_0
πPlacement Updates: @offcampusjobs_0
π Placment Material: @placement_materials0
75+ Companies Materials
100+ JOB Updates in a Month
πDM for Promotion @Wren_0
πPlacement Updates: @offcampusjobs_0
π Placment Material: @placement_materials0
Forwarded from Off Campus job Updates- Placement Material
MINDTREE Off Campus Drive | π2020 & 2021 Batch | π°3LPA
β οΈ Deadline - 30th Jan
mindtree.com/careers/campus-careers
Telegram -https://t.me/offcampusjobs_0
β οΈ Deadline - 30th Jan
mindtree.com/careers/campus-careers
Telegram -https://t.me/offcampusjobs_0
Channel name was changed to Β«Infosys Revature Exam SOLUTION / ALL EXAM SOLUTIONΒ»
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())
a=[]
for i in range(n):
a.append(int(input()))
print(check(a,n))
Python
Whales code
Telegram -
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0.
http://t.me/Coding_solution_0
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())
a=[]
for i in range(n):
a.append(int(input()))
print(check(a,n))
Python
Whales code
Telegram -
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0.
http://t.me/Coding_solution_0
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
β
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
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
β
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
Send the Question here β€οΈπ
https://t.me/good_coders
https://t.me/good_coders
https://t.me/good_coders
https://t.me/good_coders
https://t.me/good_coders
https://t.me/good_coders
def minOps(A, B):
m = len(A)
n = len(B)
# This part checks whether conversion is possible or not
if n != m:in
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)))
β Telegram- Send the Question here β€οΈπ
https://t.me/good_coders
https://t.me/good_coders
https://t.me/good_coders
m = len(A)
n = len(B)
# This part checks whether conversion is possible or not
if n != m:in
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)))
β Telegram- Send the Question here β€οΈπ
https://t.me/good_coders
https://t.me/good_coders
https://t.me/good_coders
Channel name was changed to Β«TCS NQT Infosys Exam SOLUTION / ALL EXAM SOLUTIONΒ»
Reasoning 10 am slot
1 197
2 341
3 304
4.73
5.858
6.1192
7.I
8.A
9.C
Telegram-
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
1 197
2 341
3 304
4.73
5.858
6.1192
7.I
8.A
9.C
Telegram-
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
http://t.me/Coding_solution_0
Telegram
Off Campus Job Update
500+ Placement & Competitive Exam Materials
75+ Companies Materials
100+ JOB Updates in a Month
πDM for Promotion @Wren_0
πPlacement Updates: @offcampusjobs_0
π Placment Material: @placement_materials0
75+ Companies Materials
100+ JOB Updates in a Month
πDM for Promotion @Wren_0
πPlacement Updates: @offcampusjobs_0
π Placment Material: @placement_materials0