CODING SOLUTIONS | IBM | AMAZON CODING SOLUTIONS
Open in Telegram
8 815
Subscribers
No data24 hours
-207 days
-11730 days
Posts Archive
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
Doctor[] doctor=new Doctor[n];
for(int i=0;i<n;i++) {
int id=sc.nextInt();
sc.nextLine();
String name=sc.nextLine();;
double salary=sc.nextDouble();
int age=sc.nextInt();
doctor[i]=new Doctor(id, name, salary, age);
}
sc.nextLine();
String arg= sc.nextLine();
if(findMaximumAgeDoctor(doctor)==null)
System.out.println("No Doctor found with mentioned attribute.");
else
System.out.println(findMaximumAgeDoctor(doctor));
if(searchDoctorByname(doctor,arg)==null)
System.out.println("No Doctor found with mentioned attribute.");
else {
System.out.println(searchDoctorByname(doctor,arg));
}
}
//1st
public static Doctor findMaximumAgeDoctor(Doctor[] arr){
Doctor d=null;
int max=Integer.MIN_VALUE;
for(Doctor b:arr) {
if(b.getAge()>max)
{
d=b;
max=d.getAge();
}
}
return d;
}//end 1st
//2nd
public static Doctor searchDoctorByname(Doctor[] arr,String name){
Doctor res=null;
for(Doctor d:arr) {
if(d.getName().equalsIgnoreCase(name))
res=d;
}
return res;
}//end 2nd
}//end solution class
class Doctor{
private int id;
private String name;
private double salary;
private int age;
public Doctor() {
}
public Doctor(int id, String name, double salary, int age) {
super();
this.id = id;
this.name = name;
this.salary = salary;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "id-" + id + "\nname-" + name + "\nsalary-" + salary + "\nage-" + age ;
}
}
PRA 2 Java code🤡
https://t.me/codingsolution_all
Python Unix:
awk 'BEGIN{FS="|";count = 0;IGNORECASE=1}
{
if($4!="2nd sem" && $3 == "english")count++;
}
END{
print count;
}
Java unix
Python Unix:
awk 'BEGIN{FS="|";count = 0;IGNORECASE=1}
{
if($4!="2nd sem" && $3 == "english")count++;
}
END{
print count;
}
https://t.me/codingsolution_all
1-> zzzazzzz
2-> b,d
3-> cp
4-> ^pat
5-> sort -r
6-> a
7-> select distinct
8-> b
9->truncate
10-> 2
11-> a
12-> c
13-> a
14-> 0
15-> a
16-> var carname
17-> object
18-> to program
19-> a
20-> c -> p{color:black;}
21-> document
22-> 44
23-> a
24-> name
25-> checkbo
26-> new
27-> a
28->a=200,b=100
29-> true
30-> true
Java 🔴
🔊🔊🔊Attention here 🔊🔊🔊
👉👉👉 IRA 18th April👈👈👈👈
🤩🤩🤩All Mcqs for JAVA & PYTHON🤩🤩🤩
Fees - Just share my channel link in all groups for the ones who need IRA help 🙈
Free ✅✅
Share it with full power and I will help you to clear IRA 💥💥💥
Note:- If you show laziness in sharing it, I won't give my 100% for IRA. Share more and more to IRA candidates👍
🤡Make it 3k subscribers to get FREE IRA help on 18th April
https://t.me/codingsolution_all
def recur_factorial(n):
if n == 1:
return n
else:
return n*recur_factorial(n-1)
num = 7
if num < 0:
print("Sorry, factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
print("The factorial of", num, "is", recur_factorial(num))
Factorial of a number using recursion
Python
Telegram https://t.me/codingsolution_all
n=int(input())
a=list(map(int,input().split())
a.sort()
m=a[-3]
print(a.index(m))
Python 3
k=int(input())
arr=[int(i) for i in input().split(',')]
n=[]
for i in arr:
n.append(str(i))
n=n[::-1]
l=[]
s = set(arr)
for i in s:
if arr.count(i)>k:
n.remove(str(i))
l.append(str(i))
print(",".join(n[::-1]))
print(",".join(l))
Delete Backups After Kth Run
Python
https://t.me/codingsolution_all
a=input ()
b=input ()
if b in a:
print ("yes")
else:
print ("no")
String within String
Python 3
https://t.me/codingsolution_all
🤡Tomorrow 🆓 ITIS PRA 🤡
https://t.me/codingsolution_all
Share ✅Share ✅Share ✅
Counting Bits
Python
https://t.me/codingsolution_all
Share ✅
⭐Capgemini
Minimum Speed Required
Python
https://t.me/codingsolution_all
Square Matrix
Python
https://t.me/codingsolution_all
