Stream to find the second highest distinct number Optional secondHighest = numbers.stream().distinct() // Removeduplicates .sorted(Comparator.reverseOrder()) // Sort in reverse order .skip(1) // Skip the first (highest) number .findFirst(); // Get the second distinct number
I just cleared. My technical round for the same role. Java developer, java spring boot and micro-services. Day after tomorrow i have managerial round. What salary can i expect? What should i prepare on for my managerial round
We should also put . distinct which removes duplicates because we may have duplicates so the desc sorted stream second elem may also be the first largest.
a small change in your solution: List arrayList2=arrayList.stream().sorted().toList(); Integer secondMax= arrayList2.get(arrayList2.size()-2); these two lines were enough.
She had all things in her tongue..
thanks for sharing :) All the best for your career:)
please suggest some realtime interview of java 8 microservices springboot including aws and kafka
Coding Question
find 2nd largest element
what was the current ctc
and excepted ctc
women are scary, she memorized the whole book and ratatatatatata...Damn.
Strictly speaking she has mugged everything.... It's ok to mug after all getting offer is more important
Thanks for sharing.
Please try to ask code answer also, that would be helpful for freshers.
Very very simple questions
please tell me important interview question for java springboot developer for infosys
What's the last question for coding? Please provide full code and question
Sorry, just recording was shared with us.
Stream to find the second highest distinct number
Optional secondHighest = numbers.stream().distinct()
// Removeduplicates
.sorted(Comparator.reverseOrder()) // Sort in reverse order
.skip(1) // Skip the first (highest) number
.findFirst();
// Get the second distinct number
Total how many rounds are there?
I just cleared. My technical round for the same role. Java developer, java spring boot and micro-services. Day after tomorrow i have managerial round. What salary can i expect? What should i prepare on for my managerial round
Congratulations, Can you please share your interview questions and experience.
Could you please share your interview questions?
Actually, you did good😁
😆
actually basically ....basically actually 😅😅😅
Wow. She is so good. Who is she?
Call me by my name and not by calling me “Sir”! “Basically” is not so basic anymore but rather has become complexed and troublesome.
Voice is not clear
Thanks.
You're welcome
Actually...😂
Basic Questions.
THANKS DADDY
Atleast Type kar lete bro
Arrays.stream(arr1).boxed().sorted(Comparator.reversedOrder).skip(1).findFirst().get();
find second highest number in array
We should also put . distinct which removes duplicates because we may have duplicates so the desc sorted stream second elem may also be the first largest.
those people who insert "like", "actually", etc. in every sentence they spit out, are very annoying actually 🙃
Goog interview
She is not good at logical skills
Solution to the coding problem:-
List arrayList2=arrayList.stream().sorted().toList();
Integer max= arrayList2.get(arrayList2.size()-1);
arrayList2 = arrayList2.stream().filter(i -> !i.equals(max)).toList();
System.out.println(arrayList2.get(arrayList2.size()-1));
arrayList.stream().filter(o->o!=arrayList.stream().max(Comparator.comparing(Integer::valueOf)).get()).limit(1).forEach(System.out::println);
a small change in your solution:
List arrayList2=arrayList.stream().sorted().toList();
Integer secondMax= arrayList2.get(arrayList2.size()-2);
these two lines were enough.
Interviewer expects logic ...if do like these they don't accept