Round 1:
What is saga. which are Two types of saga.
What is API gateway: What technology u r using for API gateway. Any specific framework
- Istio
- Zuul. What is zuul filter and details
How will you expore your APi end point to outer world ?For exposing your API to external world. We have 2:
- Consul
- swagger
What is Load balancers. Can you implement the same in java ? How are you doing load balacing in your application
Ans: Inside config
- web-app: microservice
Dev:
Stage: < url>
prod:
What new feature java8 has added to hashmap. I said tree. he asked about what would be worst case complexity and normal complexity
Java8 new features overall
Collection.sort which sort they using internally. what design patterns they use to select which sort to apply.
Java 8 feature: function interface explain
what is Circuit breaker. Have you heard of it ?
Program: You have Arr<> of size M having -10million to +10 milliion data.
Find Smallest positive int > 0 which is not present in array
Input:
[1,3,6,4,1,2]
Output: 5
[1,2,3]
Output: 4
Time: o(n) -worst case
Space: o(n) - worst case
< My Solution>: Map<arr[i], count>:
mp.put(1, 2);
mp.put(3, 1);
mp.put(6, 1);
mp.put(4, 1);
mp.put(2,1);
if(are!=null || arr.size() == 0) {
return; //expected
}
for(long I=1; I<LONG.MAX_VALUE; I++) {
if(!mp.get(I)) {
return I;
}
}
- Ques:
int[] = { 1,2,3,4,5}11)Here how elements are stored in arrayList. Which format.
Answer: In continguous memory location like Ox01, ox02, ox03, ox04, ox05
Search: rxjava, java 14, java 9 for moer knowledge
Round 2:
class Solution {
public static void main(String[] args) {
System.out.println("Length of the longest substring: " + findLength("aabccbb"));//abc
System.out.println("Length of the longest substring: " + findLength("abbbb"));//ab
System.out.println("Length of the longest substring: " + findLength("abccde"));//abc or cde
}
public static int findLength(String s) {
int start = 0 , len = s.length(),max=0;
if(len==0 || s==null){
return 0;
}else if(len==1){
return 1;
}
HashMap<Character,Integer> map = new HashMap<>();
for(int end=0;end<len;end++){
char ch = s.charAt(end);
if(map.containsKey(ch)){
start = Math.max(start,map.get(ch)+1);
}
map.put(ch,end);
max = Math.max(max,(end - start + 1));
}
return max;
}
}
22) Can lambda be used only with functional Interface ?
23) What is functional interface in java
24) What is 2 interface has same default method and a class implementing both interface, which method if function gets called
25) Types of Autowiring, when to use which one ?
26) Diff between @restController and controller
27) What all annotations you have used in spring
28) What if stream/ filter throws an error, how to handle them. Ans: through Class E..
29) Difference between SOAP and REST
30) What is RESTFUl web services