Java Tutorial: Practice Questions on Arrays in Java

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024
  • Java Arrays Practice Set: In this video, we will see few questions on Java Arrays. We will see some good concepts like how to reverse an array, how to find maximum element in an array etc.
    ►This playlist is a part of my Complete Java Course playlist: • Java Tutorials For Beg...
    ►Source Code + Notes - codewithharry....
    ►Ultimate Java CheatSheet: codewithharry....
    ►Checkout my English channel here: / programmingwithharry
    ►Click here to subscribe - / @codewithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Python Tutorial In Hin...
    ►Python Complete Course In Hindi - • Python Tutorials For A...
    ►C Language Complete Course In Hindi -
    • C Language Tutorials I...
    ►JavaScript Complete Course In Hindi -
    • JavaScript Tutorials I...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Django Complete Course In Hindi -
    • Python Django Tutorial...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithhar...
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

ความคิดเห็น • 2K

  • @abulkalamasif1270
    @abulkalamasif1270 3 ปีที่แล้ว +11

    // Question 7 - Finding out the minimum element of Array
    int[] arr2 = {-1, -4, 53, -32, -6, 92, 10, -372};
    int min = Integer.MAX_VALUE;
    for (int elem: arr2) {
    if (elem < min) {
    min = elem;
    }
    }
    System.out.println(min);

  • @realheckertrustmebro
    @realheckertrustmebro 2 ปีที่แล้ว +140

    This is actually funn, Watching this video at 2 AM, Understanding something new in the silence of night, I watched your 2D array video 4 times before moving ahead and it turns out that i understood array but was having difficulty with understanding nested loops, i needed to watch some other videos about nested loops to understand them, i am not complaining about that, this playlist is awesome, a single person cannot handle everything so perfectly but you still made it perfect!! Thankyou for this amazing Playlist and listing it on the internet for free, You are not teaching a youtube user, you are shaping the Indian future!

    • @shubhanshukushwaha6150
      @shubhanshukushwaha6150 2 ปีที่แล้ว +3

      That's the quality that Harry bhai had

    • @gaming0peration27
      @gaming0peration27 ปีที่แล้ว +1

      I also have the same problem. Can you tell me from where you cleared nested loops ?

    • @aamir4684
      @aamir4684 9 หลายเดือนก่อน +1

      same bro i am also watching his video at 4:00 am in the silence of night🥰

    • @ankurddank_afmishra1196
      @ankurddank_afmishra1196 6 หลายเดือนก่อน

      @@gaming0peration27 codeitup

    • @sejalsanjayvamja
      @sejalsanjayvamja 6 หลายเดือนก่อน

      I have same problem. Nested loop is hard

  • @harshgaming-ce9zl
    @harshgaming-ce9zl ปีที่แล้ว +3

    26:17 we can use the - - from the length to 0 then this will be solve i have example
    int [] a = {1,2,3,4};
    // for (int i = a.length-1; i>-1; i--)
    // {
    // System.out.println("Reverse Number is = " + a[i]);
    // }

  • @KajalSingh-xg8jp
    @KajalSingh-xg8jp 2 ปีที่แล้ว +30

    These practice problems make concepts much more clear. Thank you so much Harry sir!

  • @vkumar1066
    @vkumar1066 3 ปีที่แล้ว +35

    Clearing the doubts in Q5 . Many people had this confusion.. For reversing the array.
    brother you have to reverse the array. Not just u have to print the values in reverse.
    think on it once. Earlier I also used to think the same way. But got cleared.
    In the method explained by harry bhai he is trying to reverse the actual array and that is what the question is about. The question is not to print the array in reverse order.

    • @AshishKhetwal
      @AshishKhetwal 6 หลายเดือนก่อน +1

      same confusion i had! thanks !

    • @amarkumarsahu9295
      @amarkumarsahu9295 4 หลายเดือนก่อน +1

      Same confusion !! Thnx

    • @pragandebnath3915
      @pragandebnath3915 3 หลายเดือนก่อน

      Use two array that's similar to your process , just store the values in reverse order of one into other and equate them later

    • @pankajsanwlot633
      @pankajsanwlot633 2 หลายเดือนก่อน

      public class arrayrev {
      public static void main(String[] args) {
      int [] group ={58,69,25,14,6};
      for(int i=group.length-1 ;i>=0;i--){
      System.out.print(group[i] + ",");
      }
      }
      }
      it just print it reversed.. not completely reverse the whole Array

  • @zeeshanali4502
    @zeeshanali4502 ปีที่แล้ว +9

    i started learning from apna college untill i found you they are good in theoretical part but for better understanding it needded practical knowledge and thats what u r giving us thanks harry bhaiya u r doing great work for everyone

  • @aishwarya1895
    @aishwarya1895 4 ปีที่แล้ว +487

    Great work bruh... Though I am not learning java right now but i saw your notification and came here to support your video✌😁

    • @iarpit__khandelwal
      @iarpit__khandelwal 4 ปีที่แล้ว +10

      Please Tell Harry Sir

    • @aishwarya1895
      @aishwarya1895 4 ปีที่แล้ว +2

      @@iarpit__khandelwal what?

    • @iarpit__khandelwal
      @iarpit__khandelwal 4 ปีที่แล้ว +1

      @@aishwarya1895 Please Tell Me How To Solve This Problem
      Harry Sir Ne Aapka cooment like kar diya but problem ka answer nhi diya

    • @felon_loser
      @felon_loser 4 ปีที่แล้ว +1

      Same here, I am in the middle of you Python course right now! Just completed Akhbaar Padhke Sunaao

    • @artishsharma7859
      @artishsharma7859 4 ปีที่แล้ว +1

      @@iarpit__khandelwal ego or attitute😡

  • @Mayank-yz5nn
    @Mayank-yz5nn 4 ปีที่แล้ว +41

    This is the only channel whose video I watch in full screen!!😁

  • @vaibhavnayak3416
    @vaibhavnayak3416 3 ปีที่แล้ว +2

    System.out.println("Problem number 8");
    int min = Integer.MAX_VALUE;
    for (int i : array) {
    if (i < min) {
    min = i;
    }
    }
    System.out.println(min);
    Thanks for this amazing course

    • @Yavi609
      @Yavi609 5 หลายเดือนก่อน

      : operator is work like ternary operator ?

    • @Spacifist
      @Spacifist 3 หลายเดือนก่อน

      ​@@Yavi609no ....check FOR EACH LOOP VIDEO IN THIS COURSE ITS AFTER ARRAY VDO

  • @Sameer00121
    @Sameer00121 ปีที่แล้ว +2

    29:03 instead of going through broader way ,we can reverse an array by this way
    int [] arr = {1,2,3,4,5,6,7,8,9};
    int l = arr.length;
    for(int i=l-1;i>=0;i--)
    {
    System.out.print(arr[i] +" ");
    }
    above program i think is simplest way to reverse an array

  • @soumyashreemohapatra7488
    @soumyashreemohapatra7488 3 ปีที่แล้ว +23

    It's just fabulous. I'm a computer science student but when I read the array concept in the college it was not as clear and understanding as this videos. Thank you Harry sir for giving us such fabulous free course video!!!!

  • @ankitasingh734
    @ankitasingh734 3 ปีที่แล้ว +8

    Practice set is the heart of your teachings, to grasp every concept.

  • @toshitsingh7270
    @toshitsingh7270 3 ปีที่แล้ว +40

    40:40 putting max=arr[0] instead of max=0, would be better. It will work for both negative and positive integers(all integers) in the array. And if the array is empty then we could put if else statement to check if length of array is 0 or not.

    • @atirrasheedhashmi
      @atirrasheedhashmi 2 ปีที่แล้ว

      Yeah, You were right as it will check each element within given array 👍
      Thank You

    • @mnabeel7276
      @mnabeel7276 ปีที่แล้ว

      Wow! brilliant

    • @Ronit785
      @Ronit785 ปีที่แล้ว

      Thanks 👍then it will work for minimum also, the process of harry was working for only max not for min🙂

    • @KUMARARYANCSE--
      @KUMARARYANCSE-- 8 หลายเดือนก่อน

      Yes its working for min but how can you tell plese?

  • @Rohit-0019
    @Rohit-0019 ปีที่แล้ว +2

    For finding minimum element code
    int [ ]arr={12, 849, 0, 93, 01, 87};
    int i;
    int min=arr[0];
    for(i=0;i

    • @apurbadutta867
      @apurbadutta867 5 หลายเดือนก่อน

      in this way it will give the max value you need to use > this sign bro

  • @Manu_Sharma9
    @Manu_Sharma9 ปีที่แล้ว +42

    Practice Problem 1 - 1:06 Practice Problem 2 - 4:44 Practice Problem 3 - 9:29 Practice Problem 4 - 11:19 Practice Problem 5 21:17 Practice Problem 6 37:19 Practice Problem 7 43:15

  • @eaglehunter6487
    @eaglehunter6487 3 ปีที่แล้ว +5

    42:44 Harry bhai maza hi aa gaya. WOnderful course. The best channel for learning Java, Python etc.

  • @krishnawadhwani5393
    @krishnawadhwani5393 3 ปีที่แล้ว +7

    This Is The Best Video Of The Playlist BTW Now I Am 1 Star On Code Chef

  • @vishalvishu1817
    @vishalvishu1817 2 ปีที่แล้ว +12

    the loops are really really hard atleast for me as a beginner and i am unable to build logic in most of these question but i still think the problem will be solved sooner or later if i will keep following your videos so *THANKS A LOT* for putting this great effort

    • @maazahmad3405
      @maazahmad3405 2 ปีที่แล้ว +4

      same here bro, it's quite difficult for beginners

    • @prakashpatne3301
      @prakashpatne3301 2 ปีที่แล้ว +1

      Same here bro🤔🤔

    • @Luffy_2804
      @Luffy_2804 ปีที่แล้ว

      what's the progress now

    • @amey1723
      @amey1723 ปีที่แล้ว

      yes bro same condition

  • @everysecond6872
    @everysecond6872 2 ปีที่แล้ว +2

    It is good. I was learning 1 video everyday. From past few weeks couldn't keep up everyday but trying my best. Loving that i am learning JAVA programming.

  • @hitarthshah5549
    @hitarthshah5549 8 หลายเดือนก่อน

    Question number 7 :
    public class CWH_29_Practice_Set_6 {
    public static void main(String[] args){
    int [] arr = {1,2,25,56,78,789};
    int min = Integer.MAX_VALUE;
    for(int element: arr){
    if(element < min){
    min = element;
    }
    }
    System.out.println("Minimum element in the array: "+min);
    }
    }
    Output :
    Minimum element in the array: 1
    42:46 Yes Sir understanding the concepts clearly. Thank you very much!

  • @rock8938
    @rock8938 2 ปีที่แล้ว +10

    //To find minimum element in an array
    public class Main
    {
    public static void main(String[] args) {
    int [] arr={1,8,4,9,23,2,-3,5};
    int min=arr[0];
    for(int element: arr){
    if(element

  • @awesomeadarsh7012
    @awesomeadarsh7012 3 ปีที่แล้ว +93

    this is one of the toughest video in this playlist (till this video)

    • @pubgclutches8481
      @pubgclutches8481 3 ปีที่แล้ว +1

      Fuck yeah

    • @pubgclutches8481
      @pubgclutches8481 3 ปีที่แล้ว +7

      Matrix wala to smjh hi nhi aya mujhe

    • @rajsinghparihar1695
      @rajsinghparihar1695 3 ปีที่แล้ว +2

      right bro questions are bit difficult for beginners

    • @suhail9511
      @suhail9511 3 ปีที่แล้ว +6

      To be honest mene pura video nahi dekha or mene sirf sari problems solve kardi, it wasn't tough at all, I mean some questions are tricky but not tough...

    • @parththakkar9748
      @parththakkar9748 3 ปีที่แล้ว +3

      @@pubgclutches8481 i marked this video 3 months back when i was watching this series and now when i arrived here second time trust me every question seems easy to me and the concepts were eye opening sometimes

  • @vijayvinith4154
    @vijayvinith4154 3 ปีที่แล้ว +18

    Well, ive been late to this by quite a bit but I've been enjoying learning coding alongside you and one day even though im pursuing electrical engineering, this gives me hope that one day I'll be able to earn a good paying job in the IT sector

  • @MuhammedAbbas-hb6od
    @MuhammedAbbas-hb6od 2 ปีที่แล้ว

    41:45
    Minimum value
    int [] arr = {120, 330, 50, 80, 69};
    int min = Integer.MAX_VALUE;
    for (int e:arr){
    if (e

  • @cybergrand1021
    @cybergrand1021 ปีที่แล้ว

    43:09 // Question 7 answer submission;
    int min = arr[0]; // Assume the first element as the minimum
    for (int e : arr) {
    if (e < min) {
    min = e;
    }
    }
    System.out.println(min);

  • @paragkaushik9595
    @paragkaushik9595 3 ปีที่แล้ว +18

    shortcut way of reversing an array:
    int age[] = {23,21,20,30,29,28};
    for(int i=age.length-1; i>=0; i--){
    System.out.print(age[i]+" ");
    }

    • @pushpendradubey9312
      @pushpendradubey9312 3 ปีที่แล้ว

      Same

    • @Nadaniyaaa
      @Nadaniyaaa 3 ปีที่แล้ว +5

      But here the problem is that you have just printed the array in reverse order...and not actually reversed it...like by that logic used in the video,you are actually changing the value stored at the i th address with the value stored at( l-i-1)th address..and in whole reversing the array

    • @meetupadhyay9454
      @meetupadhyay9454 3 ปีที่แล้ว

      I have done the same thing ..but I think swapping array elements is also an interesting thing to learn

    • @anujraj0
      @anujraj0 3 ปีที่แล้ว +1

      Yeah I also use this simple method but i don't know why harry bhai has used long method.

    • @arpitmishra1622
      @arpitmishra1622 3 ปีที่แล้ว

      @@Nadaniyaaa Awesome point, i got it thanks

  • @snehapodder9606
    @snehapodder9606 3 ปีที่แล้ว +4

    I can't be thankful enough to you, for saving my semester! Dilse respect! We find God in people like you ❤

    • @jaybhimani8142
      @jaybhimani8142 3 ปีที่แล้ว

      Same 🤗

    • @javalovergaming
      @javalovergaming 3 ปีที่แล้ว

      Sahi kaha aapne

    • @femiwaykepappa2922
      @femiwaykepappa2922 3 ปีที่แล้ว

      Corona ko bhi thanks bolo..
      Na jane kitne logo k semester bachaye hai corona ne..

    • @btxearn6040
      @btxearn6040 3 ปีที่แล้ว

      people like you can find God in humans and in idols ,,,,,cmon The god cant be seen or imagine be mature

  • @abhishekvishwakarma9045
    @abhishekvishwakarma9045 4 ปีที่แล้ว +6

    Best JAVA series from beginner to advanced 😉😉👌🔥

  • @shamlikolhe5630
    @shamlikolhe5630 5 หลายเดือนก่อน

    You know what I just can't control myself saying "I LOVE YOU HARRY BHAI". U are great. I am from mechanical background still able to code; this is just because of YOU.

  • @Entertainmentvideo23508
    @Entertainmentvideo23508 2 ปีที่แล้ว +1

    You are one of the best teacher in the world!

  • @itskeshhu
    @itskeshhu 4 ปีที่แล้ว +4

    21:19
    Don't you think it's lot easier to reverse an array by using the following code😉
    But your method also taught me some new concept.
    System.out.print("Thanks!")
    👇👇👇
    int marks[]={95, 96, 95, 96, 86};
    for(int i=marks.length-1; i>=0; i--){
    System.out.println(marks[i]);
    }

    • @CodeWithHarry
      @CodeWithHarry  4 ปีที่แล้ว +8

      Hi Keshav,
      This is not reversing the array but printing the array in reverse order.

    • @itskeshhu
      @itskeshhu 4 ปีที่แล้ว

      @@CodeWithHarry thanks for correcting me😄

    • @hrushikeshthorat8238
      @hrushikeshthorat8238 4 ปีที่แล้ว +1

      I thik you can store the array in temp variable then print temp
      It will print an reverse array and will not change the original value
      Temp[i]=marks[i];
      System. Out.print(Temp[i]);

    • @shauryaagarwal6834
      @shauryaagarwal6834 4 ปีที่แล้ว +1

      @@CodeWithHarry i agree sir

  • @dorababuarig765
    @dorababuarig765 4 ปีที่แล้ว +4

    These practice questions are really very helpful. Thankyou Harry bayya for your hardwork and dedication.
    Thankyou

  • @vaibhavpatil8297
    @vaibhavpatil8297 3 ปีที่แล้ว +3

    at 41:06
    we can rather use
    int max = arr [0];
    so now our default max value is first value of array
    and it will get updated if any next value in array is bigger(or smaller if we want to find minimum).
    so we can use this rather than finding max and min values possible in data type integer
    Harry bhai full to maja aa raha hai course me at this point mai addict ho gya hu coding se sirf aapki vajah se

  • @paarthsarthy
    @paarthsarthy 2 ปีที่แล้ว

    int a = 34;
    int b = 78;
    b = a+b;
    a = b-a;
    b = b-a;
    just another logic to swap two numbers!
    Great Course!

  • @mightyprogrammer2899
    @mightyprogrammer2899 2 ปีที่แล้ว +1

    harry bhai question no 5
    practice problem no. 5 // to reverse an array element
    what a lesson yrr
    superb idk how to thanks
    Thank you so much.

  • @LiTtLeGyAnBySubhash
    @LiTtLeGyAnBySubhash 4 ปีที่แล้ว +7

    Java course k liye maine v request kiya tha Harry, 😎
    So thanx for this amazing course 😊

  • @sauravsharma8461
    @sauravsharma8461 4 ปีที่แล้ว +44

    I am actually watching your python series ( for beginners ) that you made 2 years ago .
    Just wanna say thanks !

    • @felon_loser
      @felon_loser 4 ปีที่แล้ว

      me too

    • @programmer4047
      @programmer4047 4 ปีที่แล้ว +5

      CodeWithHarry Channel Dheeme-Dheeme Bekaar Hota Jaa Rha Hai ... Uske Purane Courses Kafi Acche The .... Ab *Notes* Wali Video Aati Aur Watchtime Ke liye Video Ko Faltu Me Bada Bana Diya Jaata Hai ...
      Ab Sirf School Wale Bachcho Ko Target Kiya Jata Hai ( Notes Bana Ke )
      Aur Machine Learning / Angular / React Jaisi Cheeze To Khatm Hi Ho Gyi Hai
      I am Watching CodeWithHarry Since He Had 40K

    • @sauravsharma8461
      @sauravsharma8461 4 ปีที่แล้ว

      @@programmer4047 thanks for the info .

    • @abhixtech9195
      @abhixtech9195 4 ปีที่แล้ว

      Bro you can watch codewithharry python in one video new one
      2 years ago videos are so old some commands doesn't work now u can right codes in visual studio code pycharm is not good so much visual studio code is good

    • @felon_loser
      @felon_loser 4 ปีที่แล้ว

      @@abhixtech9195 i dunno about that. i started coding from HTML, and used VSCode then. When I begun python, i tried pycharm, but couldn't install it. that is why is use VSCode too

  • @himankjeshwar8636
    @himankjeshwar8636 2 ปีที่แล้ว +20

    30:54 - We can also solve this problem using decrementing for - loop

    • @HamzaShahzadEB_
      @HamzaShahzadEB_ 2 ปีที่แล้ว +1

      Yes that is easy but this is sorting and searching type solution 🙂

    • @41gaurav9hb2
      @41gaurav9hb2 2 ปีที่แล้ว +3

      In decrementing for - loop the array is not reversed only the elements are printed in reverse order but here the array in reversed, if you print array
      by Arrays.toString(array) then you find the whole array is reversed....

    • @semicolon6499
      @semicolon6499 2 ปีที่แล้ว +1

      This method be use for Data Structure also we need to understand this algorithm .

    • @randomgaming2280
      @randomgaming2280 2 ปีที่แล้ว

      Decrementing for - loop method is easy

  • @faizanjan102
    @faizanjan102 2 ปีที่แล้ว

    46:24
    we can also use
    ----------------------------------
    for (int i=1; i h[i]){
    isSorted = false;
    break;
    }
    }

    • @ytuser0101
      @ytuser0101 2 ปีที่แล้ว

      can you tell me why in second loop -1 was used (int i=0; i

  • @NoobCoder623
    @NoobCoder623 2 ปีที่แล้ว +1

    Best video on all concepts of array at beginners level.
    Best explanation.May god bless you for giving us this course ❤️❤️.

  • @rajkumarverma4645
    @rajkumarverma4645 4 ปีที่แล้ว +5

    You are the person who actually contribute in others life

  • @saudagaransar7135
    @saudagaransar7135 2 ปีที่แล้ว +9

    such an amazing practice set, learned so many things in this video , thanks harry bhai.

    • @Saurabhsr17
      @Saurabhsr17 2 ปีที่แล้ว

      puri playlist k baad puri java aa jayegi
      ???

    • @saudagaransar7135
      @saudagaransar7135 2 ปีที่แล้ว +2

      @@Saurabhsr17 if tumne practice kiye ache se to definitely, bus tutorial hell me mat fasna

    • @yashu1703
      @yashu1703 ปีที่แล้ว

      @@saudagaransar7135 what u want to say by ur 2nd statment, i don't understand

    • @saudagaransar7135
      @saudagaransar7135 ปีที่แล้ว +1

      @@yashu1703 i mean that dont just watch video, do practice as well

    • @yashu1703
      @yashu1703 ปีที่แล้ว

      @@saudagaransar7135 ok

  • @eaglehunter6487
    @eaglehunter6487 3 ปีที่แล้ว +32

    //Question 7
    //Write a Java program to find the maximum element in a Java array.
    int []arr={1,2,3,4,5,6};
    int min=Integer.MAX_VALUE;
    for(int element:arr){
    if(element

    • @siddiquizaid4315
      @siddiquizaid4315 3 ปีที่แล้ว +2

      Maximum array find kar rha hai to min kyu likha hai

    • @Aspect_GT
      @Aspect_GT 3 ปีที่แล้ว

      @@siddiquizaid4315 sahi hai uska

    • @AshishKumar-pq6pr
      @AshishKumar-pq6pr 2 ปีที่แล้ว

      Last line jara samjhaana bhai.... kyoon likha???

  • @biswajeet9826
    @biswajeet9826 6 หลายเดือนก่อน

    Can't believe this is free!!
    That's why this is Underrated!!

  • @chetnabansal370
    @chetnabansal370 ปีที่แล้ว +1

    Needless to say that videos are full of new concepts and fun. Earlier I thought, in order to reverse the array we could just start iteration from arr.length till 0 but it didn't work (of course, how stupid was I !). Idk if you will ever read my comment or not but I literally want you to say a big THANK YOU !!

    • @randomx7629
      @randomx7629 ปีที่แล้ว

      try arr.length-1 till 0...coz last index is not equal to arr.length

  • @OdishaStudyTime
    @OdishaStudyTime 4 ปีที่แล้ว +5

    5:10 problem-2 (i tried to solve this in less number of codes)
    int [] a ={2,3,4,5,6};
    int b=4;
    for( int element:a)
    {
    if (b==element){
    System.out.println("The number is present");
    }
    }

  • @saternal7603
    @saternal7603 4 ปีที่แล้ว +8

    //Harry you can easily reverse an array this way. No use of complexity
    int[] result = { 0, 0 ,0 ,0 ,0};
    int [] array = { 14 , 22 , 43 , 44 , 45};
    int counter = -1;
    for(int i=4;i>=0;i--) {
    counter++;
    result[counter] = array[i];
    }
    for(int element:result) {
    System.out.print(element +" ");
    }

    • @deepanshusaini6242
      @deepanshusaini6242 2 ปีที่แล้ว

      your code is complex os do this
      int [] f= {1,2,3,4,5};
      for (int g=f.length; g>0; g--){
      System.out.println(g);
      }

    • @manjunathn5251
      @manjunathn5251 2 ปีที่แล้ว +1

      you guys are just printing it in a reverse way and not actually reversing the values of it

  • @cuberkam9072
    @cuberkam9072 4 ปีที่แล้ว +4

    30:00
    //Harry bhai u can easily reverse an array in this way
    for(int i = a.length-1; i>=0;i--){
    System.out.print(a[i]);
    }

    • @cuberkam9072
      @cuberkam9072 4 ปีที่แล้ว +2

      Why did you make it so complex😂

    • @gaurangvishnoi8995
      @gaurangvishnoi8995 4 ปีที่แล้ว +2

      The same question is in my head right now.😁

    • @saternal7603
      @saternal7603 4 ปีที่แล้ว +1

      it prints but doesnt reverse the array

    • @cuberkam9072
      @cuberkam9072 4 ปีที่แล้ว +1

      @@saternal7603 o yes thanks for telling
      Sorry Harry Bhai Maine ache se nahi dekha

    • @ytuser0101
      @ytuser0101 2 ปีที่แล้ว

      This is not reversing the array but printing the array in reverse order.

  • @Luffy_2804
    @Luffy_2804 ปีที่แล้ว

    float [] num = {12.5f , 13.8f , 101.02f , 99.99f , 78.7f};
    float store = 0;
    for(int i =0; i

  • @priyankapatil6521
    @priyankapatil6521 3 ปีที่แล้ว

    Thank you sir...it becomes easy after watching this vedio to solve array problem...you give easy steps to solve array problems...thank you very much sir

  • @avdhootbhuvad1947
    @avdhootbhuvad1947 4 ปีที่แล้ว +6

    This practice set was very helpful for me. Learn many new things thanks to you . Keep it up Harry bhai ♥

  • @tejashwinihosur1712
    @tejashwinihosur1712 2 ปีที่แล้ว +3

    Got to know many things in this practice set.💫✨🙏🏻Thanks Harry Bhai

  • @sparshkapoor134
    @sparshkapoor134 3 ปีที่แล้ว +4

    woah these questions are literally amazing

  • @monalisasharma3616
    @monalisasharma3616 6 หลายเดือนก่อน

    Thank you so much ...!!!. Earlier it was very difficult for me to solve array questions. Now, I am able to solve around 80% of questions💖

  • @royfamily9273
    @royfamily9273 2 ปีที่แล้ว

    Concepts Pura clear ho gaya Harry Bhaiya maja hi aagaya ekdam.

  • @crimsonx1772
    @crimsonx1772 3 ปีที่แล้ว +8

    we can also swap the elements without using the temp variable
    arr[i] = arr[i] + arr[l - i -1];
    arr[l - i -1]= arr[i] -arr[l - i - 1];
    arr[i] = arr[i] - arr[l-i-1];

  • @razinmaksudahmedkarimi8367
    @razinmaksudahmedkarimi8367 3 ปีที่แล้ว +15

    Bhai question 5 ko esse kar te to easy rehta bohot
    int[] i={3,4,5,2,3,1};
    int k=i.length-1;
    for(k=i.length-1;k>=0;k--){
    System.out.println(i[k]);

    • @vkumar1066
      @vkumar1066 3 ปีที่แล้ว +12

      brother you have to reverse the array. Not just u have to print the values in reverse.
      think on it once. Earlier I also used to think the same way. But got cleared.
      In the method explained by harry bhai he is trying to reverse the actual array and that is what the question is about. The question is not to print the array in reverse order.

    • @kajolkeshri65
      @kajolkeshri65 3 ปีที่แล้ว +2

      @@vkumar1066 you know what, i was also thinking the same thing but after reading your comment i Got my answer

    • @avinashmishra905
      @avinashmishra905 3 ปีที่แล้ว

      @@vkumar1066 brother then how to write plz mention the code..still confused

    • @vkumar1066
      @vkumar1066 3 ปีที่แล้ว

      @@avinashmishra905 code is already is the video.
      I will try to clarify. pls focus on these two lines.
      The question is to reverse the array means if an array is {1,2,3,4} then think of another array which is {4 ,3,2,1}. what do you notice here?
      they are reverse of each other not because i have written in reverse order but they are also stored in reverse order.
      and that is question, we dont have to just print it in reverese. but we also have to store it in reverse order. so that the actual array is reversed. But in case of just printing array the actual array remains same.

  • @sachinprajapatkd
    @sachinprajapatkd 3 ปีที่แล้ว +11

    // Write a Java program to find the minimum element in a Java array.
    int []arr={109,23,44,155,66};
    int min=Integer.MAX_VALUE;
    System.out.println(min);
    for (int e:arr) {
    if (e

  • @ramphapal6610
    @ramphapal6610 ปีที่แล้ว

    Maja Aa gaya😊 bohat hi Aachhye the problem,, or bohat kuch sikhane ko mila,, thanks harry bro❤

  • @69shintrehrishikesh53
    @69shintrehrishikesh53 ปีที่แล้ว

    Best tutor of Java I have had until now ❤❤

  • @top10creation84
    @top10creation84 4 ปีที่แล้ว +6

    int [] arr ={1,2,3,4,5,6,7,8,9};
    int min =Integer.MAX_VALUE;
    for (int element :arr)
    {
    if (element < min)
    min = element;
    }
    System.out.println("The minimum value in array is"+min);

  • @msp10100
    @msp10100 3 ปีที่แล้ว +35

    this tutorial is hard

    • @PanditAyushparashari
      @PanditAyushparashari 8 หลายเดือนก่อน +2

      Nope this is very very easy

    • @tirthraval225
      @tirthraval225 7 หลายเดือนก่อน +6

      It has to be to make your brain force to work and think

    • @AryanSingh-dj5bj
      @AryanSingh-dj5bj 5 หลายเดือนก่อน

      Mfs like you who don't even understand a single word comment like this just to be cool 😂...keep it up kid !​@@PanditAyushparashari

  • @namanjain9941
    @namanjain9941 4 ปีที่แล้ว +10

    harry sir, apn practice problem 5 ko ese bhi solve krr skte thee thoda easy ho jata
    //Question no.5 - Write a java program to reverse an array
    class Main{
    public static void main(String[] args) {
    int [] array = {1, 2, 3, 4, 5, 6};
    int l = 0;
    for (int i = 5;i>=l;i--){
    System.out.print(array[i]);
    System.out.print(" ");
    }
    }
    }

    • @ajayshekhawat2292
      @ajayshekhawat2292 3 ปีที่แล้ว +1

      Harry bhai ka code koi bhi general array k liye hai
      Lekin tumhara code sirf array= (1,2,3,4,5) k liye hi work karega

    • @arceus9594
      @arceus9594 3 ปีที่แล้ว

      Btw Que. 5's name has to be Swapping Array Instead Of Reverse Array

    • @prathameshmalode5524
      @prathameshmalode5524 3 ปีที่แล้ว

      //why this didnt give reverse of array.i made array wanting input by user
      import java.util.Scanner;
      public class practice {
      public static void main(String[] args) {
      Scanner sc= new Scanner(System.in);
      System.out.println("how many elements do you want to enter");
      int num = sc.nextInt();
      int [] elements = new int[num];
      for (int i = 0; i

    • @ajayshekhawat2292
      @ajayshekhawat2292 3 ปีที่แล้ว +1

      @@prathameshmalode5524 I

    • @prathameshmalode5524
      @prathameshmalode5524 3 ปีที่แล้ว

      @@ajayshekhawat2292 sry my mistake

  • @hameedferoz8804
    @hameedferoz8804 ปีที่แล้ว

    Sabse Best Practice Set tha ye. Thank you Harry Bhai

  • @icecul6463
    @icecul6463 ปีที่แล้ว

    Hey, Harry I find your videos helpful. In ques 5 I've done it like this in easy way ----->>
    int mat1[] ={1,2,3,4,5};
    for(int i = mat1.length-1; i>=0; i--){
    System.out.print(mat1[i] + " ");
    }

    • @navedhasansci7459
      @navedhasansci7459 ปีที่แล้ว

      sir can you please explain how it works

    • @icecul6463
      @icecul6463 ปีที่แล้ว

      @@navedhasansci7459 dekho bhai,
      1. mene 1 matrix(array) liya "mat1" k naam ka
      2. Fir mene ek for loop lagaya
      3. For loop ka explanation -->
      - > Ek in "i" name ka variable liya
      - > "i" ko "mat1" ki length(function)-1 k barabar kar diya, because length 5 aae gi usme se 1 kam karna pade ga kyuki jab ham for loop matrix "mat1" k elements ki position k liye chalae ge to maximum position "mat1" ki length-1 k equal hogi.
      - > "mat1.length-1" is equal to the position of the last element of the matrix "mat1".
      - > fir hamne "i>=0" likha matlab ye jo for loop chale ga wo "mat1" k last element ki position se (jo ki 4 hai) tab chale ga jabtak "i" ki value 0 se badi hogi ya 0 k barabar hogi, matlab ye 5 baari chale ga.
      - > fir hamne "i--" likha kyuki hame for loop chalana h or 4 se lekar 0 tak chalana h ulta.
      4. "System.out.print(mat1[i]+" ")"Ab mai matrix "mat1" k ek element ki value print kara rha hu, kyuki i hamara "mat1.length-1" k equal hai to jab for loop pehli baar chale ga to "mat1[i]" ki value "mat1.length-1" k equal ho jaae gi jo ki 4 aae gi.
      To "mat1[i] = mat1[4]" iska matlab matrix "mat1" ka 4th element print ho jaae ga jo ki 5 hai
      Aise hi jab doosri baar chale ga for loop tab 4 print ho jaae ga
      Or aise hi har ek element print ho jaae ga in reverse.

    • @navedhasansci7459
      @navedhasansci7459 ปีที่แล้ว

      @@icecul6463 bro thank you bhai aapne java seekh liye ya konse episode pr ho

    • @icecul6463
      @icecul6463 ปีที่แล้ว

      @@navedhasansci7459 mai around 50th video pe tha cwh k but fir mujhse library management system wala question solve nhi hua to maine thoda or concepts clear karne k liye practice questions kiye the but fir b pata nhi mujhse wo question solve nhi hua ab mai thoda or concepts samajh kr wapis cwh se java start kru ga

  • @PrathamCreations
    @PrathamCreations 2 ปีที่แล้ว +5

    Harry bro , for problem no 5 ...
    what if we don't swap the number ..instead we use a reverse for loop to print array?

    • @faisalshafiq2616
      @faisalshafiq2616 2 ปีที่แล้ว

      i have the same doubt as i have done it in a much shorter code ????//

    • @codyandersan
      @codyandersan 9 หลายเดือนก่อน +2

      No, the question says you have to actually reverse the array, not just to print it in reverse order..

  • @sumitsinghal1868
    @sumitsinghal1868 ปีที่แล้ว +5

    Question 4 I have done using scanner in which user can input the values in the matrix and the add them.
    import java.util.Scanner;
    public class Question_4 {
    public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    //Asking elements to store in the Matrices;
    int[][] mat1=new int[2][3];
    int[][] mat2=new int[2][3];
    for(int i=1;i

    • @maskedgamer4016W
      @maskedgamer4016W 2 หลายเดือนก่อน

      The easier method is this bruh
      import java.util.*;
      class Practice {
      public static void main(String[] args) {
      Scanner sc = new Scanner (System.in);
      System.out.println("Enter the elements of the first & second array (alternatively).");
      int[] [] a= new int[2][3];
      int [] [] b = new int[2][3];
      int [] [] c = new int [2][3];
      for (int i = 0 ;i

  • @IronMan-or1xf
    @IronMan-or1xf 4 ปีที่แล้ว +9

    Sir can u pls create a seperate playlist for python projects only??
    It will help me a lot so that I can easily practice projects and can also create some projects by my own,
    This is my kind request, I hope u will help me

    • @tejalchavan1344
      @tejalchavan1344 4 ปีที่แล้ว

      He has already made one for practice programs, it's almost similar and u should check it out

  • @manjindersidhu7620
    @manjindersidhu7620 2 ปีที่แล้ว +1

    Seriously Boht mza aaaaa rha hai ji………. 😋😇

  • @abhinavrawat2048
    @abhinavrawat2048 7 หลายเดือนก่อน

    man you are too good when it comes to explaining things...thank you so much

  • @rajatshukla7754
    @rajatshukla7754 4 ปีที่แล้ว +5

    Sir can you please explain how to take input of array elements from user using keyboard
    Thank you❤

    • @thelastpuff3564
      @thelastpuff3564 ปีที่แล้ว

      you can use scanner for taking input to an matrix
      import java.util.Scanner;
      public class Main {
      public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      System.out.print("Enter the number of rows: ");
      int rows = scanner.nextInt();
      System.out.print("Enter the number of columns: ");
      int cols = scanner.nextInt();
      int[][] matrix = new int[rows][cols];
      System.out.println("Enter the matrix elements:");
      // Taking input for the matrix
      for (int i = 0; i < rows; i++) {
      for (int j = 0; j < cols; j++) {
      matrix[i][j] = scanner.nextInt();
      }
      }
      // Printing the matrix
      System.out.println("Matrix entered:");
      for (int i = 0; i < rows; i++) {
      for (int j = 0; j < cols; j++) {
      System.out.print(matrix[i][j] + " ");
      }
      System.out.println();
      }
      }
      }
      try this

  • @ankushpagarwar9582
    @ankushpagarwar9582 ปีที่แล้ว +3

    maja aa gya

  • @boro3775
    @boro3775 4 ปีที่แล้ว +9

    Please start ds in algo in Java with this java series in continuity 🙏🙏🙏🙏🙏

  • @sandhya5042
    @sandhya5042 11 หลายเดือนก่อน

    This java course is really helpful. The college didn't taught me anything the way u did. Thank you so much ❤.

  • @sainaid
    @sainaid 11 หลายเดือนก่อน

    These practice problems are really helpful to make Arrays concepts clear. Thank you for such an amazing playlist.

  • @suprabhatnandi8598
    @suprabhatnandi8598 4 ปีที่แล้ว +4

    Hi,Just want to know by when you will complete this java playlist,just a rough estimate.

  • @Mayank-yz5nn
    @Mayank-yz5nn 4 ปีที่แล้ว +28

    Sir, it's getting complex.
    Difficult to understand 😭

    • @akaza8615
      @akaza8615 4 ปีที่แล้ว

      Then watch again

    • @KGFFan-kw9cj
      @KGFFan-kw9cj 4 ปีที่แล้ว

      in 2d array

    • @rohananand8253
      @rohananand8253 3 ปีที่แล้ว

      Yes then watch again this video

    • @salmanmehmood180
      @salmanmehmood180 3 ปีที่แล้ว +3

      this is replacement of answer 5
      int [] rev={6,5,4,3,12,1};
      for (int i=rev.length-1;i>=0;i--){
      System.out.println(rev[i]);
      }

    • @gametimewitharyan6665
      @gametimewitharyan6665 3 ปีที่แล้ว +1

      To understand it better, just first listen the question and then try to solve it by yourself, and if you are not able to solve then watch the solution for answer and understanding

  • @AnimeFusionHub25
    @AnimeFusionHub25 2 ปีที่แล้ว

    Bhai MAZA hi AAGAYA...kya hi concepts Explain kara hai

  • @smrutiranjan779
    @smrutiranjan779 11 หลายเดือนก่อน

    Literally mind blown for a beginner 🔰 , and make them so strong in array , like me . Thanks sir .

  • @MohammedMufish_Shaikh
    @MohammedMufish_Shaikh 2 ปีที่แล้ว +2

    Tagda course bro .😎👌👌👍👍

  • @ashutosh5406
    @ashutosh5406 3 ปีที่แล้ว +1

    maza aa raha h harry bhai... thank you so much bro. you're doing great work for our country.

  • @DanteHanma-l6q
    @DanteHanma-l6q ปีที่แล้ว

    bhai agar aapka video se concept clear nhi hua toh mereko nhi pata kiske yahaan se hoga. great job bhai keep going😍😍😍😍😍

  • @rajarishabhsingh8296
    @rajarishabhsingh8296 2 ปีที่แล้ว +1

    Bole to mja aa gya 🤟🤩 thanku harry bhaiya

  • @SamyakJain-on5wu
    @SamyakJain-on5wu ปีที่แล้ว

    at 34:53 we can do
    int [] marks = {1,2,3,4,5,6,7,8,9,10};
    for(int i=marks.length-1;i>=0;i--){
    System.out.println(marks[i]);
    }
    this to reverse an array in question 5

  • @gurunehra4702
    @gurunehra4702 2 ปีที่แล้ว +2

    For que 5. We can just make tempArray and perform following 1 line in for loop
    tempArray[i] = array[array.length-i-1]
    And then assign our original array with this tempArray by writing
    array = tempArray
    And that's it
    a for loop with one like code
    And assigning is enough. As i think.

  • @manavsatasiya1018
    @manavsatasiya1018 2 ปีที่แล้ว

    41:40
    we can also find min value like this
    public static void main(String[] args) {
    int []arr = {1,2,3,4,34,-3,68,22};
    int max = 0,min=0;
    for(int i=0;i

  • @10arryasarkarxb15
    @10arryasarkarxb15 2 ปีที่แล้ว

    THANKS BHAIYA KYA BADHIYA REVESION KARVAYA HAI BEFORE EXAMS!😁

  • @sharannarsingi7578
    @sharannarsingi7578 ปีที่แล้ว

    //Practice question 7 :
    int[] x = {324,24,24,52,45,34,635,653};
    int min = Integer.MAX_VALUE;
    for(int e: x) {
    if(e < min){
    min = e;
    }
    }
    System.out.println("The value of the minimum number is : " + min);
    }

  • @unroyalrawreal4019
    @unroyalrawreal4019 2 ปีที่แล้ว

    for practice problem 2 (without using for each loop and boolean) :-
    int [ ] nm = {8,9,10};
    for (int i =0; i

  • @alexsimons3804
    @alexsimons3804 3 ปีที่แล้ว +1

    Bhot maza aaya Harry bhai
    Thank you so much for this spectacular course...
    Much appreciate it bhai.

  • @shubhamshekhar7689
    @shubhamshekhar7689 ปีที่แล้ว +1

    Maja a Gaya Harry sir !...
    Thankyou so much !....for supporting and practice and learning in JAVA programming language with guidance by you 😀 😀 😀 ☺️ ☺️ ☺️ ☺️ ❤❤❤❤😊😊😊😊

  • @dineshbhaisolanki3209
    @dineshbhaisolanki3209 2 ปีที่แล้ว +1

    Thanks for Explaining this Way !!

  • @techamatuer8115
    @techamatuer8115 ปีที่แล้ว +1

    I really enjoyed this practice set because when you face a difficult question and you fail but you don't stop and you know it is out of your reach but you are still practicing then overall the conclusion is i understood the array of concept

  • @arshuarshad1551
    @arshuarshad1551 3 หลายเดือนก่อน

    35:12 so tough apne reverse ka program bhot tough way mei bta diya jb k bhot easy logic h ye khud quiz mei btaya tha aap array k

  • @nikhilgulhane31
    @nikhilgulhane31 2 ปีที่แล้ว +1

    Unbeatable Harry bhai even he can boost the confidence of civil engineering students !!!!!

  • @kamalthakur9749
    @kamalthakur9749 2 ปีที่แล้ว

    Thank you sir
    question 1 to 3
    import java.util.Scanner;
    public class Main
    {
    public static void main(String[] args)
    {/*
    // program 1 : calculate an array of 5 float and calculate their sum;
    float []weight;
    weight = new float[5];
    weight[0]=36.6f;
    weight[1]=98.7f;
    weight[2]=67.89f;
    weight[3]=72.95f;
    weight[4]=96.35f;
    float total = weight[0]+weight[1]+weight[2]+weight[3]+weight[4];
    System.out.println("Total Weight is "+total);
    */
    //program 2:Write a program to find out whether a given integer is present in an array or not.
    /*
    int [] marks = {45,65,23,54,32,53,53,32,64,45};
    int num = 23;
    boolean check = false;
    for (int i=0; i

  • @YouTubeKAYDEN
    @YouTubeKAYDEN 2 ปีที่แล้ว

    Course awesome hai
    Bahut achi tarah se samajh me aagaya hai
    Thanks Harry Bhai 💯🤩😍🤗👍

  • @KshitijGammer
    @KshitijGammer 2 ปีที่แล้ว +1

    42:20 annother way maybe
    int [] arr={ 5,6,8,95,4};
    int min=arr[0];
    for(int e:arr){
    if(e

    • @Anonymous_810
      @Anonymous_810 2 ปีที่แล้ว

      You are comparing the array with itself right??

  • @user-wx3px7fy7r
    @user-wx3px7fy7r ปีที่แล้ว +2

    Roasting mai carry or code mai Harry are the best😂❤❤

  • @IIM_life_by_Divya
    @IIM_life_by_Divya 2 ปีที่แล้ว

    wooww ,bahut accha harry bhai ,thanks for teaching,bahut maza aaya aur knowledge bhi