I really liked the questions she asked , it really forced ne to brainstorm Also , not sure why she was saying that the complexity of first program will be n2 .
1)Nested loop case only it will be : O(n2), but O(n)+O(n) - O(n) only. 2) As per my knowledge, things if you want to execute for certain number of times, either loop or recursive.
I had also given interview for Java Developer(2 yrs experience). Two rounds were done and informed by HR that I'm selected and there will be 1 last 3rd technical round but still waiting for invite. It's been more than 10 days and HR told me that they are conducting now final round interview on the basis of notice period. I'm not sure whether I'll receive invite or not. Only 1 month is remaining for me.
These kinds of experiences are very common these days. I would say if HRs are not responding in these notice period days then what can you expect after you join. So, whatever is happening maybe it's for your own good brother.
Program to find second largest number with single loop could be like this: private static int findSecondLargestNumber(int[] a, int length) { if(length < 2) { return -1; } int largest = 0; int secondLargest = 0; if(a[0] > a[1]) { largest = a[0]; secondLargest = a[1]; } else { largest = a[1]; secondLargest = a[0]; }
for (int i = 2; i < length; i++) { if(a[i] > secondLargest && a[i] < largest) { secondLargest = a[i]; } else if(a[i] > largest) { secondLargest = largest; largest = a[i]; } } return secondLargest; }
You can do this just using for loop; see here: int[]arr={1,6,3,7,5}; int max1=arr[0],max2=0; for(int i=0;i< arr.length;i++) { if(arr[i]>max1) { max2=max1; max1=arr[i]; } } System.out.println("Largest-1:"+max1); System.out.println("Largest-2:"+max2);
bro what are the things to be learnt in order to be called as JAVA DEVELOPER? (Currently I only know basics of Java, and currently learning DSA. What should I learn next (after DSA) in order to get a Product Based Companies
@@PrashantSharmaOfficial I am 3.5 yrs experienced professional and given more than 50 interviews I think, Still in some of the interviews I encounter new question where my confidence gets low
@@PrashantSharmaOfficial bro i got oncampus offer last year during start of my 4th year im 2023 passout but still they havent onboarded us do you any idea why it is getting delayed im getting worried🥲
2nd Largest Single Loop : --- public static void find2ndLargest() { int[] arr = {1,2,3,4,5,67,-1,121,1050,8}; int largest = arr[0]; int secLar = arr[0];
@@PrashantSharmaOfficial okay nice I have a question I have 6 months of experience in Java spring boot I know all the answers to these questions in the video So what is the correct time to switch to product based company
So, for product based companies you need more than just Spring Boot. You need good DSA and then Java or Spring Boot. But, there is never a good time to switch, whenever you feel like switching, do it...
Someone is sitting beside this guy and helping....watch the video completely and you 'll get to know
haha thanks for the insights. But, unfortunately I was all alone/single while giving this interview. But, thanks for watching the video completely.
I really liked the questions she asked , it really forced ne to brainstorm
Also , not sure why she was saying that the complexity of first program will be n2 .
Yeah, I think she was confused a bit about this.
1)Nested loop case only it will be : O(n2),
but O(n)+O(n) - O(n) only.
2) As per my knowledge, things if you want to execute for certain number of times, either loop or recursive.
Using range we can print counting this method comes in Java stream api
immutable should have only getter not setter method
Yep and that's what was said afterwards too in the interview.
7:22 bro you have already mentioned wrapper classes are immutable.. for only mutable class you need to return clone of object from getter
Yeah, if I have said that the custom object was immutable then no need to get the clone of that object.
Big O notations padhne chayiye madam ko, sahi complexity batayi fir bhi confuse krdia😢
I had also given interview for Java Developer(2 yrs experience). Two rounds were done and informed by HR that I'm selected and there will be 1 last 3rd technical round but still waiting for invite. It's been more than 10 days and HR told me that they are conducting now final round interview on the basis of notice period. I'm not sure whether I'll receive invite or not. Only 1 month is remaining for me.
These kinds of experiences are very common these days. I would say if HRs are not responding in these notice period days then what can you expect after you join. So, whatever is happening maybe it's for your own good brother.
Pl share question asked in interview
Please let us know for what experience level you are giving an interview.
6+ years
Program to find second largest number with single loop could be like this:
private static int findSecondLargestNumber(int[] a, int length) {
if(length < 2) {
return -1;
}
int largest = 0;
int secondLargest = 0;
if(a[0] > a[1]) {
largest = a[0];
secondLargest = a[1];
} else {
largest = a[1];
secondLargest = a[0];
}
for (int i = 2; i < length; i++) {
if(a[i] > secondLargest && a[i] < largest) {
secondLargest = a[i];
} else if(a[i] > largest) {
secondLargest = largest;
largest = a[i];
}
}
return secondLargest;
}
Thanks!
Can you dry run for 1,2,1,2
You can do this just using for loop; see here:
int[]arr={1,6,3,7,5};
int max1=arr[0],max2=0;
for(int i=0;i< arr.length;i++)
{
if(arr[i]>max1)
{
max2=max1;
max1=arr[i];
}
}
System.out.println("Largest-1:"+max1);
System.out.println("Largest-2:"+max2);
Above code wont work if the second largest number comes last or after the first largest number in the array. Ex for this array of numbers 2,1,5,3
Bro can u explain me why you used main(null) in printing 1 to 10 numbers
Because String array can be initialized with null. We can use a black array too.
@@PrashantSharmaOfficial bro we can either use streams also na?? For printing
@@veerendrakumarmeka3181 Yup that can also work but here you first need another collection from 1 to n.
bro what are the things to be learnt in order to be called as JAVA DEVELOPER?
(Currently I only know basics of Java, and currently learning DSA. What should I learn next (after DSA) in order to get a Product Based Companies
Solid principals, design pattern basics
Get intouch with springboot and spring mvc
If I used to answer like this in interview like not sure and thinking much and then answering they surely do not select me😢 I don't know why
Maybe you haven't given enough interviews. Experience always teach you everything, good or bad.
@@PrashantSharmaOfficial I am 3.5 yrs experienced professional and given more than 50 interviews I think, Still in some of the interviews I encounter new question where my confidence gets low
she was confused about time complexity
Yep!
funny interview..
Yaar mam galt bol ri.. About complexity
Yep, I know but that happens a lot in interviews.
@@PrashantSharmaOfficial bro i got oncampus offer last year during start of my 4th year im 2023 passout but still they havent onboarded us do you any idea why it is getting delayed im getting worried🥲
Is it real? What CTC does it provides.
Yes. CTC depends on experience and skills in every organisation.
For how many years experience is this interview for.. How many rounds were there... And what's the status
Experience- 6+ years
Rounds- 2
Status- Selected
@@PrashantSharmaOfficial what was the 2nd round about... When did this interview happen?
2nd Largest Single Loop : ---
public static void find2ndLargest() {
int[] arr = {1,2,3,4,5,67,-1,121,1050,8};
int largest = arr[0];
int secLar = arr[0];
for(int i=1; i= largest )
{
secLar = largest;
largest = arr[i];
}
else {
if(arr[i]>secLar) {
secLar = arr[i];
}
}
}
System.out.println(largest+","+secLar);
}
Hi this is fresher real interview?
No, I gave this interview when I was having 4-5 years of experience.
you are selected accolite?
Yes, I was.
Got selected?
Fortunately, yes!!
@@PrashantSharmaOfficial okay nice
I have a question
I have 6 months of experience in Java spring boot
I know all the answers to these questions in the video
So what is the correct time to switch to product based company
So, for product based companies you need more than just Spring Boot. You need good DSA and then Java or Spring Boot. But, there is never a good time to switch, whenever you feel like switching, do it...
@@PrashantSharmaOfficialyeah I know DSA but I have to practice problems n okay thank you
@@shivakrishna7293 Best time to switch is after getting a hike in your current company
Year of experience?
More than 6 years
Ye immutable sabse puchte mujhe laga mujhse bhi puchenge are sala mere se puchta hai nitepad kholo suru hojaao code likhna😂😂😂😂😂😂😂😂😂😂🤣🤣lmaao
Haha
😁😁😁😁😁