$30
1. Write a Java code to implement Thread safe LinkedList Include below methods in your class LinkedList
public void addAtPosition(int index, int element){
}
public void removeAtPosition(int index, int element){
}
public int getFirst() {
}
public int getLast() {
}
public int size(){
}
2. Traffic Light Controlled Intersection:
There is an intersection of two roads. First road is road A where cars travel from North to South in direction 1 and from South to North in direction 2. Second road is road B where cars travel from West to East in direction 3 and from East to West in direction 4. Refer this link : (1) Traffic Light Controlled Intersection - LeetCode