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

Поделиться
HTML-код
  • Опубликовано: 9 июл 2024
  • Welcome to Code Decode, your go-to channel for mastering Java 8 coding interview questions and arrays. In this video, we dive deep into the trickiest Java 8 coding interview questions related to arrays, providing comprehensive explanations and step-by-step solutions.
    Udemy Course of Code Decode on Microservice k8s AWS CICD link:
    openinapp.co/udemycourse
    Course Description Video :
    yt.openinapp.co/dmjvd
    Here are some of the key questions we cover:
    Finding the second smallest element in an array: This question tests your ability to work with arrays and apply Java 8's features effectively. It assesses your understanding of stream operations, sorting, and filtering techniques. Mastering this question enhances your problem-solving skills and demonstrates your grasp of Java 8's functional programming capabilities.
    Finding common elements between two arrays: This question challenges your proficiency in array manipulation and stream processing. It evaluates your ability to leverage Java 8's stream API to efficiently identify shared elements. Excelling in this question showcases your understanding of advanced array operations and stream filtering techniques.
    Reversing an array of integers in-place: This question assesses your knowledge of array manipulation and in-place algorithms. By utilizing Java 8's features, you showcase your ability to reverse an array efficiently without creating a new one. Demonstrating proficiency in this question highlights your understanding of memory optimization and array traversal techniques.
    Finding the length of the longest string in an array: This question evaluates your string manipulation skills using Java 8's stream operations. It tests your ability to combine stream filtering, mapping, and reduction to obtain the length of the longest string. Excelling in this question showcases your expertise in working with string arrays and stream transformations.
    Mastering these Java 8 coding interview questions not only helps you excel in technical interviews but also enhances your overall programming skills. These questions cover essential concepts, such as array manipulation, stream processing, and functional programming, which are widely used in Java development.
    Code Decode's comprehensive explanations and step-by-step solutions empower you to understand the underlying concepts and apply them effectively. By practicing these questions, you'll gain confidence in your Java 8 skills and increase your chances of success in coding interviews.
    Most Asked Core Java Interview Questions and Answers: • Core Java frequently a...
    Advance Java Interview Questions and Answers: • Advance Java Interview...
    Java 8 Interview Questions and Answers: • Java 8 Interview Quest...
    Hibernate Interview Questions and Answers:
    • Hibernate Interview Qu...
    Spring Boot Interview Questions and Answers:
    • Advance Java Interview...
    Angular Playlist: • Angular Course Introdu...
    SQL Playlist: • SQL Interview Question...
    GIT: • GIT
    Subscriber and Follow Code Decode
    Subscriber Code Decode: ruclips.net/user/CodeDecode?...
    LinkedIn: / codedecodeyoutube
    Instagram: / codedecode25
    #java #interviewquestions #codedecode

Комментарии • 109

  • @RaushanKumar-rd7we
    @RaushanKumar-rd7we Год назад +5

    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  Год назад +1

      Correct Raushan 👍👍 that edge case scenario is left to be covered like we did in first question 👏👏

  • @FBHI
    @FBHI Месяц назад

    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 6 месяцев назад +2

    Thanks for creating such videos, would you please create a video continuation of this? This will be very helpful.

  • @mrrishiraj88
    @mrrishiraj88 11 месяцев назад +1

    Thanks

  • @poonamkale5882
    @poonamkale5882 9 месяцев назад +1

    Love to watch ur content. It will be more helpful if u provide ur source code for same

  • @bhoslegovind9644
    @bhoslegovind9644 10 месяцев назад +2

    Thanks mam for provides us such a important content..We will waiting for next part of that video 🤗🎉

  • @bhalulal5947
    @bhalulal5947 Год назад +2

    Love you for this video 👌👌👌 what a video 👌👌 waiting for next part

  • @argonechaks9850
    @argonechaks9850 Год назад +6

    Yes we need more such questions covered

    • @CodeDecode
      @CodeDecode  Год назад

      Sure 😊👍

    • @mohanvs-msv
      @mohanvs-msv Год назад

      ​@@CodeDecodeYes we need more problems like this...!!

  • @KrishnaveniNakanamoni
    @KrishnaveniNakanamoni Год назад +2

    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  10 месяцев назад

      Thanks Krishna 😊

  • @nishantdeep3973
    @nishantdeep3973 Год назад +7

    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  Год назад +2

      Many many congratulations Nishant for cracking interviews 🎉🎉🎉🎉 well done Man keep learning keep shining 🌟🌟. Sure👍👍

    • @BlueBird-yg4po
      @BlueBird-yg4po 9 месяцев назад

      Where can I find interview

  • @vikasrai4915
    @vikasrai4915 19 дней назад

    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

  • @nikunjkheni8503
    @nikunjkheni8503 Год назад +2

    Nice questions and its solution. Keep up creating videos !

    • @CodeDecode
      @CodeDecode  Год назад

      sure nikunj we will create more like this

  • @kumudgoel6520
    @kumudgoel6520 10 месяцев назад +1

    thank you mam, the way of explaining is very superb

  • @paridadeepika
    @paridadeepika 11 месяцев назад

    Thank u so much for sharing such videos..

  • @rushisharma1222
    @rushisharma1222 Год назад +2

    It is nice topic are covered on java 8 features 😊

  • @boxofgames3
    @boxofgames3 Год назад +1

    Your explanation is always awesome mam.. keep rock

  • @sharadsingh2856
    @sharadsingh2856 Год назад +1

    Very useful thanks

  • @MohitKhare
    @MohitKhare 10 месяцев назад +1

    Always a big fan. Thanks.

  • @punitsakre4608
    @punitsakre4608 Год назад +3

    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);

  • @shrutik1863
    @shrutik1863 Год назад +1

    Awesome, waiting for next vh ideo

    • @CodeDecode
      @CodeDecode  11 месяцев назад

      sure we will upload it soon

  • @ajeetola715
    @ajeetola715 2 месяца назад +1

    firts time viewing your vedio best helpfull vedio mam ....i subscribed and like .....and heartly thanku mam

  • @sivakrishna1994
    @sivakrishna1994 Год назад +2

    Really so useful ...ur videos r awesome..pls make some professional java courses olayilisy

  • @supriya0129
    @supriya0129 9 месяцев назад +5

    Instead of using available functions explain with logic because HRs only asks for logic

  • @Sigma-Coding-dm3it
    @Sigma-Coding-dm3it 7 месяцев назад +1

    great job maam

  • @ishankotru7652
    @ishankotru7652 Год назад +1

    Absolutely magnificent

    • @CodeDecode
      @CodeDecode  Год назад

      Thanks 🙂👍

    • @ishankotru7652
      @ishankotru7652 Год назад

      @@CodeDecode will you plz try some complex problems in data structures

  • @tiituma
    @tiituma 3 месяца назад +1

    Thanks a lot

  • @annajiraoannepu2718
    @annajiraoannepu2718 2 месяца назад +1

    good explanation.

  • @akashsaha9366
    @akashsaha9366 Год назад +1

    Great video

  • @sameer9368
    @sameer9368 Год назад +1

    Great🎉

  • @jskr456
    @jskr456 Год назад +1

    well explained

  • @nivaschintu8850
    @nivaschintu8850 3 дня назад

    It's better if you solve them without inbuilt methods
    As beginning cannot understand the methods directly

  • @kudumulasivaramakrishnared6379

    hi, can u please do a video on HashMap custom key ?

  • @start1learn-n171
    @start1learn-n171 5 месяцев назад +1

    Tq

  • @subhrajitsaha233
    @subhrajitsaha233 Год назад +1

    Please upload more videos on stream

  • @nikitasarda7389
    @nikitasarda7389 Год назад +1

    We need many more questions

  • @harshitsachdeva4836
    @harshitsachdeva4836 Год назад +1

    Bring more videos for this

  • @jagrutipatil1020
    @jagrutipatil1020 Год назад +1

    👍☺️

  • @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!!

  • @mohammedraza4846
    @mohammedraza4846 2 дня назад

    Nome of the interviewer will ask you to use pre defined Classes and methods, you need to write the logic specially for freshers

  • @rishiraj2548
    @rishiraj2548 Год назад +2

    🙏👍💯

  • @chintu069
    @chintu069 8 месяцев назад

  • @anilrouto4513
    @anilrouto4513 11 месяцев назад

    When can we expect the next video ???

  • @DushmantaKSahu
    @DushmantaKSahu Месяц назад

    reverse a list--- List arr=Arrays.asList(1,2,3,4,5);
    arr.stream().collect(Collectors.toCollection(LinkedList::new)).descendingIterator().forEachRemaining(System.out::println);

  • @robinbhargava111
    @robinbhargava111 Год назад +1

    Indori Rocks !!!

  • @ramprasath4788
    @ramprasath4788 Год назад +1

    liked commets

  • @ajitdighe3293
    @ajitdighe3293 10 месяцев назад +1

    When will the next video be posted arrays programming?

    • @CodeDecode
      @CodeDecode  10 месяцев назад

      Soon Ajit 👍👍

  • @deepa8177
    @deepa8177 9 месяцев назад

    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

  • @takber92
    @takber92 Год назад +1

    The approach to Q1 is not the best.
    Sorting is expensive than searching so a linear search is much better to use.

  • @gowrisankar2177
    @gowrisankar2177 9 месяцев назад +1

    Hi please provide remaining array questions

  • @aashishjadhav4415
    @aashishjadhav4415 11 месяцев назад +1

    We can solve this problem using Max heap

  • @akashtanajigurav8226
    @akashtanajigurav8226 3 месяца назад

    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

  • @arpit1145
    @arpit1145 Год назад +1

    We can using distinct to remove duplicates.

    • @CodeDecode
      @CodeDecode  Год назад +1

      Multiple multiple ways of doing same thing Arpit 👍👍

  • @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 10 месяцев назад

      breaks when there are duplicate elements

    • @akshayjawale1372
      @akshayjawale1372 8 месяцев назад

      how to solve this?@@inzi27

  • @sureshmanne7245
    @sureshmanne7245 Год назад +1

    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 Год назад +1

      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 Год назад +2

      int maxLength = Arrays.stream(strings).mapToInt(string -> string.length()).max().orElse(0);

    • @AshokKumar-ml5pn
      @AshokKumar-ml5pn Год назад

      Check int maxLength line once

    • @CodeDecode
      @CodeDecode  Год назад +1

      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

  • @eminentAp
    @eminentAp 6 месяцев назад

    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

  • @Oscar-zu3lo
    @Oscar-zu3lo Год назад

    Promo'SM ✅

  • @Srikanth-mp2li
    @Srikanth-mp2li 2 месяца назад

    Audio not clear

  • @rajnikantyadav1298
    @rajnikantyadav1298 3 месяца назад

    This is not for beginners 😅😅 and we can use more simple ways to solve these problems.

  • @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