Java 8 Arrays Programming Interview Questions and Answers for freshers and experienced | Code Decode

  Рет қаралды 72,491

Code Decode

Code Decode

Күн бұрын

Пікірлер: 114
@RaushanKumar-rd7we
@RaushanKumar-rd7we Жыл бұрын
Sister, for Q2. common in two Array, the output is not correct if elements are not distinct in array1. so I think need to add: distinct() as well. Now output correct: public class Intersection { public static void main(String[] args) { int[] arr1 = {1,2,3,4,4,5}; int[] arr2 = {4, 4,5,6, 7}; findIntersection(arr1, arr2); } public static void findIntersection(int[] arr1, int[] arr2){ List intersection = Arrays.stream(arr1).distinct().filter(i-> Arrays.stream(arr2).anyMatch(j-> j == i)).boxed().toList(); System.out.println(intersection); } }
@CodeDecode
@CodeDecode Жыл бұрын
Correct Raushan 👍👍 that edge case scenario is left to be covered like we did in first question 👏👏
@Crazy77772
@Crazy77772 7 күн бұрын
I feel like for the 1st questions we can approach as below if you are a beginner like me: I personally feel the below approach is more logic oriented as it can be understood by anyone and isn't as confusing as shown in video as the video uses so many inbuilt methods. I just learned array yesterday and felt happy for being able to solve it completely by myself haha. Please do suggest me if there's more simpler methods and logical than this one. In the below program, I simply found the smallest array and then again run a loop which neglects the smallest array and goes on to look for another small number. public class Ques { public static void main(String[] args) { // Finding second smallest array int []a= {-100,-20,80,60}; int min1=Integer.MAX_VALUE; int min2=Integer.MAX_VALUE; for(int i=0;i
@nishantdeep3973
@nishantdeep3973 Жыл бұрын
Hey mam... started learning Java 8 6 months ago from ur given playlist as a beginner and now cracking multiple coding rounds in MNCs. Thanx a lot for that, I have one query if u can pls include in next video - the approach that u have used in reverse array via forEach(Consumer Interface) ,how can we done same for checking integerPalindrome via filter( Predicate).
@CodeDecode
@CodeDecode Жыл бұрын
Many many congratulations Nishant for cracking interviews 🎉🎉🎉🎉 well done Man keep learning keep shining 🌟🌟. Sure👍👍
@BlueBird-yg4po
@BlueBird-yg4po 10 ай бұрын
Where can I find interview
@argonechaks9850
@argonechaks9850 Жыл бұрын
Yes we need more such questions covered
@CodeDecode
@CodeDecode Жыл бұрын
Sure 😊👍
@mohanvs-msv
@mohanvs-msv Жыл бұрын
​@@CodeDecodeYes we need more problems like this...!!
@FBHI
@FBHI 3 ай бұрын
wow the first one, I would only sort the array and do a "arr[1]" as an answer, but using stream gives a nice touch to it!!
@deepalimalviya6387
@deepalimalviya6387 7 ай бұрын
Thanks for creating such videos, would you please create a video continuation of this? This will be very helpful.
@punitsakre4608
@punitsakre4608 Жыл бұрын
Answer for Last Question: int[] numbers = {2, 4, 6, 8}; int except = 4; int res = Arrays.stream(numbers).filter(n -> n != except).reduce(1, (n1, n2) -> n1 * n2); System.out.println(res);
@vikasrai4915
@vikasrai4915 Ай бұрын
Very nice explaination, I finished the whole playlist in 2 days, meanwhile I was wondering whether I can get the notes and code shown in the videos, it would be really helpful, I have some interviews, will need that for revision. Thanks
@kumudgoel6520
@kumudgoel6520 11 ай бұрын
thank you mam, the way of explaining is very superb
@CodeDecode
@CodeDecode 11 ай бұрын
You are welcome
@bhoslegovind9644
@bhoslegovind9644 11 ай бұрын
Thanks mam for provides us such a important content..We will waiting for next part of that video 🤗🎉
@CodeDecode
@CodeDecode 11 ай бұрын
👍😊
@KrishnaveniNakanamoni
@KrishnaveniNakanamoni Жыл бұрын
I love ur explanation....thank u very much mam... U r helping people like me to rock the interview also To understand the concepts... Clear explanation... Nice voice... Too good.... first time viewing ur Vedios also subscribed 😊😊
@CodeDecode
@CodeDecode 11 ай бұрын
Thanks Krishna 😊
@DushmantaKSahu
@DushmantaKSahu 3 ай бұрын
reverse a list--- List arr=Arrays.asList(1,2,3,4,5); arr.stream().collect(Collectors.toCollection(LinkedList::new)).descendingIterator().forEachRemaining(System.out::println);
@rushisharma1222
@rushisharma1222 Жыл бұрын
It is nice topic are covered on java 8 features 😊
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Rushi 🙂
@ajeetola715
@ajeetola715 3 ай бұрын
firts time viewing your vedio best helpfull vedio mam ....i subscribed and like .....and heartly thanku mam
@CodeDecode
@CodeDecode 3 ай бұрын
Thanks Ajeet 😊
@supriya0129
@supriya0129 10 ай бұрын
Instead of using available functions explain with logic because HRs only asks for logic
@bhalulal5947
@bhalulal5947 Жыл бұрын
Love you for this video 👌👌👌 what a video 👌👌 waiting for next part
@CodeDecode
@CodeDecode Жыл бұрын
Sure 😊😊
@sivakrishna1994
@sivakrishna1994 Жыл бұрын
Really so useful ...ur videos r awesome..pls make some professional java courses olayilisy
@CodeDecode
@CodeDecode Жыл бұрын
Soon 🙂🙂
@IndeedShiksha_withotherstuffs
@IndeedShiksha_withotherstuffs Ай бұрын
Thanks alot Mam, could you plz create it's next part covering more such questions?
@nikunjkheni8503
@nikunjkheni8503 Жыл бұрын
Nice questions and its solution. Keep up creating videos !
@CodeDecode
@CodeDecode Жыл бұрын
sure nikunj we will create more like this
@buddha768
@buddha768 Ай бұрын
Thank you for making such good video on java8. Can you please write java program on java 8? Find the length of the longest substring with all distinct characters
@ravindrasiddavatam1097
@ravindrasiddavatam1097 5 күн бұрын
Good content
@CodeDecode
@CodeDecode 4 күн бұрын
Thanks
@MohitKhare
@MohitKhare 11 ай бұрын
Always a big fan. Thanks.
@CodeDecode
@CodeDecode 11 ай бұрын
❤️❤️
@tiituma
@tiituma 5 ай бұрын
Thanks a lot
@CodeDecode
@CodeDecode 5 ай бұрын
Most welcome
@poonamkale5882
@poonamkale5882 10 ай бұрын
Love to watch ur content. It will be more helpful if u provide ur source code for same
@sharadsingh2856
@sharadsingh2856 Жыл бұрын
Very useful thanks
@CodeDecode
@CodeDecode Жыл бұрын
Thanks
@mrrishiraj88
@mrrishiraj88 Жыл бұрын
Thanks
@annajiraoannepu2718
@annajiraoannepu2718 3 ай бұрын
good explanation.
@CodeDecode
@CodeDecode 3 ай бұрын
Thanks 😊👍
@shrutik1863
@shrutik1863 Жыл бұрын
Awesome, waiting for next vh ideo
@CodeDecode
@CodeDecode Жыл бұрын
sure we will upload it soon
@boxofgames3
@boxofgames3 Жыл бұрын
Your explanation is always awesome mam.. keep rock
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂👍
@Sigma-Coding-dm3it
@Sigma-Coding-dm3it 8 ай бұрын
great job maam
@CodeDecode
@CodeDecode 8 ай бұрын
Thanks 👍👍
@ishankotru7652
@ishankotru7652 Жыл бұрын
Absolutely magnificent
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂👍
@ishankotru7652
@ishankotru7652 Жыл бұрын
@@CodeDecode will you plz try some complex problems in data structures
@deepa8177
@deepa8177 10 ай бұрын
Informative Java 8 Interview Series, thanku, mam I think this one is the last video of this Series, not able to find the videos of last 2 questions of this current video.. 1) Remove duplicates preserving order. 2) Product of all elements except current element. Please make video on this if not made because ur logic & explanations really open ups the mind to think in different approach. thanku mam
@start1learn-n171
@start1learn-n171 7 ай бұрын
Tq
@CodeDecode
@CodeDecode 7 ай бұрын
😊👍
@sameer9368
@sameer9368 Жыл бұрын
Great🎉
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sameer 👍🙂
@paridadeepika
@paridadeepika Жыл бұрын
Thank u so much for sharing such videos..
@CodeDecode
@CodeDecode Жыл бұрын
🙂👍
@akashsaha9366
@akashsaha9366 Жыл бұрын
Great video
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Akash 🙂🙂
@jskr456
@jskr456 Жыл бұрын
well explained
@CodeDecode
@CodeDecode Жыл бұрын
Thanks
@nivaschintu8850
@nivaschintu8850 Ай бұрын
It's better if you solve them without inbuilt methods As beginning cannot understand the methods directly
@subhrajitsaha233
@subhrajitsaha233 Жыл бұрын
Please upload more videos on stream
@CodeDecode
@CodeDecode Жыл бұрын
Sure we will upload it soon
@nikitasarda7389
@nikitasarda7389 Жыл бұрын
We need many more questions
@CodeDecode
@CodeDecode Жыл бұрын
Sure we will cover it soon
@harshitsachdeva4836
@harshitsachdeva4836 Жыл бұрын
Bring more videos for this
@CodeDecode
@CodeDecode Жыл бұрын
Sure we will create it soon
@mohammedraza4846
@mohammedraza4846 Ай бұрын
Nome of the interviewer will ask you to use pre defined Classes and methods, you need to write the logic specially for freshers
@kudumulasivaramakrishnared6379
@kudumulasivaramakrishnared6379 Жыл бұрын
hi, can u please do a video on HashMap custom key ?
@robinbhargava111
@robinbhargava111 Жыл бұрын
Indori Rocks !!!
@CodeDecode
@CodeDecode Жыл бұрын
👍👍
@arpit1145
@arpit1145 Жыл бұрын
We can using distinct to remove duplicates.
@CodeDecode
@CodeDecode Жыл бұрын
Multiple multiple ways of doing same thing Arpit 👍👍
@akashtanajigurav8226
@akashtanajigurav8226 5 ай бұрын
1 Question ] Answer package z_pracxtice; public class xyzz { public static void main(String[] args) { int arr1[]= {10, 20, 30, 40, 50,50}; int big =0; int sm=0; for(int i=0;i
@aashishjadhav4415
@aashishjadhav4415 Жыл бұрын
We can solve this problem using Max heap
@CodeDecode
@CodeDecode Жыл бұрын
👍👍
@ajitdighe3293
@ajitdighe3293 Жыл бұрын
When will the next video be posted arrays programming?
@CodeDecode
@CodeDecode 11 ай бұрын
Soon Ajit 👍👍
@user-ur8fy9ef1z
@user-ur8fy9ef1z Жыл бұрын
Hi, Do you have any video how to debug the program in Java streams? Example: I do operation on stream then filter and then collect to a list.. if there are 1000 records and seems my 40th record is not filtering properly. How can i debug in eclipse with out using peek and in normal debug mode.. because usually we work with objects like employee and want to check either name or id or some other details of it. Can you please create a video for this or if you have any explanation, can you please let know.. looking forward for your response
@user-ur8fy9ef1z
@user-ur8fy9ef1z Жыл бұрын
For example, in the method reverseGivenArrayInPlace, in the foreach intermediate operator, if developer would like to check the values for i=2, then how can he peek there (not exactly peek, stop the running and check values there)? Finally, you do making great videos for the developer community. Thank you!!
@rishiraj2548
@rishiraj2548 Жыл бұрын
🙏👍💯
@CodeDecode
@CodeDecode Жыл бұрын
😊😊
@rishiraj2548
@rishiraj2548 Жыл бұрын
@@CodeDecode 👍
@gowrisankar2177
@gowrisankar2177 10 ай бұрын
Hi please provide remaining array questions
@CodeDecode
@CodeDecode 10 ай бұрын
Sure 👍
@takber92
@takber92 Жыл бұрын
The approach to Q1 is not the best. Sorting is expensive than searching so a linear search is much better to use.
@ramprasath4788
@ramprasath4788 Жыл бұрын
liked commets
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Ram 🙂👍
@anilrouto4513
@anilrouto4513 Жыл бұрын
When can we expect the next video ???
@jagrutipatil1020
@jagrutipatil1020 Жыл бұрын
👍☺️
@CodeDecode
@CodeDecode Жыл бұрын
🙂
@parteeksethi1428
@parteeksethi1428 Жыл бұрын
Last question Answere: int[] arr = {2, 3, 4, 5}; int[] ints = Arrays.stream(arr). map(i -> Arrays.stream(arr).filter(j -> j != i).reduce(1, (a, b) -> a * b)).toArray();
@inzi27
@inzi27 Жыл бұрын
breaks when there are duplicate elements
@akshayjawale1372
@akshayjawale1372 9 ай бұрын
how to solve this?@@inzi27
@sureshmanne7245
@sureshmanne7245 Жыл бұрын
String[] strings = {"Banana","Apricot","Apple","Strawberry","Mango","Pineapple"}; int maxLength = Arrays.stream(strings).mapToInt(string -> strings.length).max().orElse(0); System.out.println("Length of longest string:" +maxLength); Can you check this one, I'm getting wrong output of 6 instead of 10
@AshokNarayana-jr2wt
@AshokNarayana-jr2wt Жыл бұрын
yeah same for me also...but using method reference worked for me int max=Arrays.stream(items).mapToInt(String ::length).max().orElse(0); try these one
@AshokKumar-ml5pn
@AshokKumar-ml5pn Жыл бұрын
int maxLength = Arrays.stream(strings).mapToInt(string -> string.length()).max().orElse(0);
@AshokKumar-ml5pn
@AshokKumar-ml5pn Жыл бұрын
Check int maxLength line once
@CodeDecode
@CodeDecode Жыл бұрын
Can you check string -> strings.length . It should be string.length (not with an s)
@CodeDecode
@CodeDecode Жыл бұрын
That's because the line where method reference is used, there Suresh has written wrong code. He is mapping string with arrays.length and not string.length. He is doing strings.length not string.length. Hence wrong answer
@chintu069
@chintu069 10 ай бұрын
@Srikanth-mp2li
@Srikanth-mp2li 4 ай бұрын
Audio not clear
@eminentAp
@eminentAp 7 ай бұрын
Questions with timing :- Q1 - Given an array of integers, write a java8 program to find the second smallest element - 0:33 Q2 - Given two arrays of integers, write a java8 program to find the common elements between them - 6:31 Q3 - Write a java8 program to reverse an array of integers in-place - 14:02 Q4 - Given an array of strings, write a java8 program to find the length of the longest string - 18:59
@rajnikantyadav1298
@rajnikantyadav1298 4 ай бұрын
This is not for beginners 😅😅 and we can use more simple ways to solve these problems.
@Oscar-zu3lo
@Oscar-zu3lo Жыл бұрын
Promo'SM ✅
@sarojsahoo8763
@sarojsahoo8763 Жыл бұрын
String[] str = new String[]{"Apple","Banana","Apple","Grapes","Banana"}; List stringList = Arrays.stream(str) .collect(Collectors.groupingBy(s -> s, Collectors.counting())) .entrySet().stream() .filter(entry -> entry.getValue() < 2) .map(Map.Entry::getKey) .collect(Collectors.toList()); System.out.println(stringList);//removing duplicates while preserving original order
女孩妒忌小丑女? #小丑#shorts
00:34
好人小丑
Рет қаралды 36 МЛН
How I Did The SELF BENDING Spoon 😱🥄 #shorts
00:19
Wian
Рет қаралды 35 МЛН
Fast and Furious: New Zealand 🚗
00:29
How Ridiculous
Рет қаралды 49 МЛН
9. Java Memory Management and Garbage Collection in Depth
48:48
Concept && Coding - by Shrayansh
Рет қаралды 67 М.
Top 25 Microservice Interview Questions Answered - Java Brains
39:54
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,3 МЛН