How to Patch and Build Python 3.9.x for FIPS enabled Openssl
Introduction In this post, we will see Python 3.9.x patch for FIPS enabled…
July 04, 2019
Suppose you have two lists, and you want Union and Intersection of those two lists.
Input:
list1: [1, 2, 3, 4]
list2: [3, 4, 5, 6]
union(list1, list2): [1, 2, 3, 4, 5, 6]
intersection(list1, list2): [3, 4]
See the java code for multiple solutions:
public static List<Integer> getIntersection_1(List<Integer> l1, List<Integer> l2) {
return l1.stream().filter(l2::contains).collect(Collectors.toList());
}
public static List<Integer> getIntersection_2(List<Integer> l1, List<Integer> l2) {
Set<Integer> s1 = new HashSet<>(l1);
s1.retainAll(l2);
return new ArrayList<>(s1);
}
public static List<Integer> getIntersection_3(List<Integer> l1, List<Integer> l2) {
List<Integer> list = new ArrayList<Integer>();
for (Integer i : l1) {
if(l2.contains(i)) {
list.add(i);
}
}
return list;
}
public static List<Integer> getUnion_1(List<Integer> l1, List<Integer> l2) {
Set<Integer> result = new HashSet<Integer>();
result.addAll(l1);
result.addAll(l2);
return new ArrayList<Integer>(result);
}
public static List<Integer> getUnion_2(List<Integer> l1, List<Integer> l2) {
Set<Integer> s1 = new HashSet<>(l1);
s1.addAll(l2);
return new ArrayList<>(s1);
}
Introduction In this post, we will see Python 3.9.x patch for FIPS enabled…
Introduction We often require to execute in timed manner, i.e. to specify a max…
Introduction In this tutorial we will see, How to list and download storage…
Introduction In this post, we will see how we can apply a patch to Python and…
I was trying to install mongo extension with pecl. It gave me error: Then, I…
This is due to our web server are configured to deny accessing this directory…
Introduction This post has the complete code to send email through smtp server…
Introduction In a normal email sending code from python, I’m getting following…
Introduction In one of my app, I was using to talk to . I have used some event…
Introduction So you have a Django project, and want to run it using docker image…
Introduction It is very important to introduce few process so that your code and…
Introduction In this post, we will see a sample Jenkin Pipeline Groovy script…