Frequently Asked Java Program 18: How To Find Maximum & Minimum Values in Array

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 83

  • @abhishekbhardwaj7764
    @abhishekbhardwaj7764 4 роки тому +4

    This playlist is the most sensible playlist on java interview programs on entire UA-cam. Thanks

  • @lololeona0993
    @lololeona0993 Рік тому +6

    You explained this so well, and I am very thankful that you went step by step and explained more than once if you deemed necessary. Many teachers do not do this, and again, I am grateful that you do.

  • @Vikassingh-sv5tt
    @Vikassingh-sv5tt Рік тому +4

    sir i am very grateful to you , you take my hole fear into the air😀 previously i don't know anything logic behind programming now i give interviews very confidently ❤ just one thing please make some experienced level interview programming question also THANK YOU Again from Uttar Pradesh....

  • @sultanalazzeh63
    @sultanalazzeh63 2 роки тому +17

    int[] array = {9, 80, 7, 5, 6};
    Arrays.sort(array);
    System.out.println("Max is: "+array[array.length-1]+'\t'+"Min is: "+ array[0]);

    • @androidttp6620
      @androidttp6620 10 місяців тому

      Thank you

    • @xtrmz8191
      @xtrmz8191 22 дні тому

      Wow..👌 thanku @sultanalazzeh63 paaji❤️

  • @yogeshjadhavybj5773
    @yogeshjadhavybj5773 2 роки тому +6

    Thanku You so much sir your best for increasing my programing logic.. and the playlist is very good thankyou from maharashtra..

  • @kundanwaghulde1709
    @kundanwaghulde1709 Рік тому +2

    It is very very helpfull for beginners by your efforts somewhere someone is learning programming very effectively... thank you so much sir...

  • @madhukandukuri123
    @madhukandukuri123 9 місяців тому +4

    Arrays.sort(a); //sorts in ascending order
    Sysout(a[a.length-1]); -> max value
    Sysout(a[0]); -> minimum value

    • @MShijin1
      @MShijin1 6 місяців тому

      but it will take: Time complexity:- O(nlog n)
      Space complexity:- O(1)
      how can we do it with minimum camparison.

  • @adigameing109
    @adigameing109 4 місяці тому +1

    Explanation is very very nice , easily understandable , Thank you sir!!!

  • @nileshpardeshi7068
    @nileshpardeshi7068 5 років тому +5

    Explained in a very simple way. Thanks, sir

    • @sdetpavan
      @sdetpavan  5 років тому

      Thank you so much for your feedback. Please share my videos with your friends or colleagues.

  • @manikanta-y7t
    @manikanta-y7t Рік тому +3

    for i=1 , a[i]>max =30>50 -> if condition is false so it continues the loop , until if condition becomes true then , sets the max to that value

  • @PRIYAM.SHARMA2412
    @PRIYAM.SHARMA2412 Місяць тому

    Thank you so much sir your explanation is very nice🙏🙏

  • @tushardas1580
    @tushardas1580 2 роки тому +2

    Thank you Sir 🙏you explained logic very easily, I understood ❤. Keep doing Sir 🙏

  • @rdxdevil5083
    @rdxdevil5083 Рік тому

    Thank u sir i didn't understand how this was possible but when you understood me then I got everything.....

  • @bihari1422
    @bihari1422 2 роки тому +3

    Here we can combine both if loop inside for loop so that with same "for" iteration we can get max and min

  • @Errormakesmarter
    @Errormakesmarter 8 місяців тому +2

    Fabulous teaching sir pls some more playlist on logics and dsa

  • @NareshReddyP
    @NareshReddyP 4 місяці тому +2

    Thank you, sir... it is a very good explanation.

    • @sdetpavan
      @sdetpavan  4 місяці тому +1

      You are most welcome

  • @MuhammadShaikh-k3y
    @MuhammadShaikh-k3y Місяць тому

    Great explaination sir

  • @priyankapatil7014
    @priyankapatil7014 4 роки тому +1

    Explained in simple way..thank you so much...sir please upload more videos on string related java programs...

  • @thara_27_
    @thara_27_ Місяць тому +1

    Tnq❤

  • @jayb2894
    @jayb2894 Рік тому +1

    Thank you sir!

  • @shubhamshende9995
    @shubhamshende9995 Рік тому +1

    Amazing 🎉

  • @whatisinthenameshakespeare0015
    @whatisinthenameshakespeare0015 2 роки тому +1

    There is a 2 liner solution...
    List lst = Arrays.asList(myArrayOfNumbers);
    int max = Collections.max(lst);
    int min = Collections.min(lst);

    • @bihari1422
      @bihari1422 2 роки тому +2

      Here idea was to develop logic by not using any pre defined methods

  • @amitaswal4129
    @amitaswal4129 5 років тому +1

    You r doing great work

  • @SiddarthK-t8d
    @SiddarthK-t8d Місяць тому +1

    🙌

  • @rajeshbe2234
    @rajeshbe2234 6 місяців тому +1

    Thank you sir

  • @manendrasinghyadav7099
    @manendrasinghyadav7099 2 роки тому

    Wonderful job sir!!!

  • @SurajSingh-sy9kr
    @SurajSingh-sy9kr 2 роки тому +1

    very helpful video sir

  • @informationtechnology7114
    @informationtechnology7114 Рік тому +1

    Very helpful sir

  • @poojasharma-cc5ur
    @poojasharma-cc5ur 4 роки тому

    Thanku continue making videos on java plz

  • @snehalwakode5291
    @snehalwakode5291 Рік тому +1

    Thank u sir🙏

  • @layan2524
    @layan2524 2 роки тому +1

    Thank you so much 💗

  • @gayathridhana1000
    @gayathridhana1000 Рік тому +1

    Useful Thanku

  • @tilakpednekar9905
    @tilakpednekar9905 Рік тому +1

    well explained

  • @MohammedAli-lz3sn
    @MohammedAli-lz3sn 3 роки тому +2

    great video

  • @manalloumana5086
    @manalloumana5086 Рік тому +1

    thank you

  • @jayakarsappogu7301
    @jayakarsappogu7301 2 роки тому

    sir pls make a video in jaba 1St max,2nd max and 3rd max element from arrays

  • @jitendrapatro2930
    @jitendrapatro2930 5 років тому +1

    Sir please add frequently asked python programs

  • @cirrusar3498
    @cirrusar3498 2 роки тому

    Here for both min and Max time complexity is n^2. So is there any other solution where we can reduce time complexity?

    • @sultanalazzeh63
      @sultanalazzeh63 2 роки тому +1

      int[] array = {9, 80, 7, 5, 6};
      Arrays.sort(array);
      System.out.println("Max is: "+array[array.length-1]+'\t'+"Min is: "+ array[0]);

  • @klnreddy-g1h
    @klnreddy-g1h 3 місяці тому

    how to find array index

  • @VMATHUR128
    @VMATHUR128 4 місяці тому

    class Solution{
    // Function for finding maximum AND value.
    public static int maxAND (int arr[], int N) {
    int res=0;
    for(int i=0;i

  • @swayamprakashbhuyan
    @swayamprakashbhuyan 3 роки тому +1

    Commenting for better reach

  • @chinmoyeebhattacharjee2675
    @chinmoyeebhattacharjee2675 4 роки тому

    It will not work when 3 and 6 both are missing. can you please add the solution as well

    • @shrvr
      @shrvr 2 місяці тому

      Àà

  • @TeoBounce
    @TeoBounce Рік тому

    but this is so expensive and can be done much more efficiently

  • @kvelez
    @kvelez Рік тому

    package javaapplication23;
    import java.util.ArrayList;
    import java.util.Scanner;
    public class JavaApplication23 {
    public static void main(String[] args) {
    int[] a = {1,2,3};
    int[] b = {1,2,3,4};

    System.out.println(Math.max(0, a.length));
    System.out.println(Math.max(0, b.length));

    }

    }

    • @hamer4674
      @hamer4674 Рік тому

      This code will only work if you don't have to input array elements into scanner an all your numbers are presumed to be over 0

  • @neelmoradiya1389
    @neelmoradiya1389 Рік тому +1

    🇮🇳🇮🇳🙏🙏👍👍

  • @RakeshKumar-ox5hx
    @RakeshKumar-ox5hx 2 роки тому

    sir kindly update this list

  • @Khater-khan
    @Khater-khan 2 роки тому

    salute

  • @abhishekbhardwaj7764
    @abhishekbhardwaj7764 4 роки тому +17

    This playlist is the most sensible playlist on java interview programs on entire UA-cam. Thanks

  • @swayamprakashbhuyan
    @swayamprakashbhuyan 3 роки тому +2

    Commenting for better reach