Professional Documents
Culture Documents
1. Reader/Writer problem where u can either read from multiple sources and write to single or vice
versa.
2. notification system: in an organization need to drop mail to employees whoever did not
complete some sort of trainings. Here reading the huge data from db filtering the data and
notifying the respective ppl
3.Please try like take the csv file with 10000 rows and read all rows and write to database
with 10 threads and each thread has to carry 1000 rows like (1-1000, 1001 - 1002) but you
need total count to split and assign rows to thread. I can demo multi thread any one day.
(prefer spring batch if you know)
how @Transactional keyword works internally, and you may relate it to as a proxy pattern design
pattern. Any idea on this??
2) In E-commerce app on UI identified potential slowness due to ratings while getting the
product information(sync services) what are steps to mitigate the problem.
6) How to auto scale the pods in kubernetes and which parameters to consider for the scaling.
12) Which git branching strategy has been adopted and scenarios in case of failure ow to
revert merge vs rebase.
13) Counting character in string and print character which repeat more than 2 times.
15) How to handle the situation if your team blocked by other team deliverables.
16) How do you do code reviews and what you look for in code reviews?
18) Scenario is to deliver the code but testing not happened, How to approach this?
public int getMaximumLenghArithmaticSequence(int ar[]) {
int n = ar.length;
Arrays.sort(ar);
if (n <= 2)
return n;
int val = (dp.get(j + " " + diff) != null) ? (dp.get(j + " "
+ diff) + 1) : 2;
dp.put(i + " " + diff, val);
return ans;
// Example 2
int[] array2 = {12, 12, 12, 15, 10};
System.out.println(solution.getMaximumLenghArithmaticSequence(array2)); //
Output: 3
// Example 3
int[] array3 = {18, 26, 18, 24, 24, 20, 22};
@GetMapping(value="/all")
GET
The GET method is used ONLY to retrieve the resource and NOT to modify it or create it.
GET endpoints are said to be safe endpoints as they do not change the state of the resource.
Furthermore GET endpoints have to be idempotent. This means that making multiple
identical requests must produce the same result each and every time until a change to the
resource is carried out on the server.
GET requests should not contain a body, but should send any parameters needed for the
request in a query string. An example of this could be filter or paging parameters.
If the resource is found in the API then the endpoint must return an HTTP response code 200
(OK) together with the body containing the resource in the format the client asked for.
If the resource is not found in the API then the endpoint must return an HTTP response code
404 (NOT FOUND).
If API determines that the GET request is not properly formed then it must return an HTTP
response code of 400 (BAD REQUEST).
@Autowired
@Qualifier("second")
private Model second;
private RetrofitClient() {}
@Bean
new RetrofitClient.getInstance();
}
https://projecteuler.net/
return String.valueOf(res);
}
// tc: O(N^3)
private void t(String source, StringBuilder res) {
if(source.isEmpty()) return;
for(int i=(source.length()-1)/2;i>=0;i--) {
String sub = source.substring(0, i+1);
int matchCount = 0;
int subLength = sub.length();
int j = i+1;
while(j < source.length() && j + subLength <= source.length() &&
sub.equals(source.substring(j, j + subLength))) {
j += subLength;
matchCount++;
}
if(i == 0 || matchCount != 0) {
res.append("[" + sub + "]" + (matchCount + 1));
t(source.substring(j), res);
break;
}
}
}
https://dba-presents.com/jvm/java/278-large-files-in-rest-api
OR
https://www.oracle.com/java/technologies/javase/vmoptions-
jsp.html#PerformanceTuning
Even after sharding(partitioned ) the data, application works robustly, without any
performance issue, we can call that application partitioned tolerant
1. How to decide which database we will choose
2. How to trouble shoot memory leaks in springboot
3. After a recent release application crashes how to troubleshoot?
4. How to perform heap dump and get the heap dump
5. You have few microservices which is running on multiple instances and certain point of
time one microservice instance is down how can we check which microsevrice is down? And
there is fault tolerance is implemented here…
1. Given an integer array, move all elements that are 0 to the left while maintaining the
order of other elements in the array. The array has to be modified in-place.
Original Array
1, 10, 20, 0, 59, 63, 0, 88, 0,
After Moving Zeroes to Left
0, 0, 0, 1, 10, 20, 59, 63, 88,