Print Distinct/Unique Values of an Array | Java

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 พ.ค. 2021
  • #Java #CoreJava #Collections #javaForBeginners Check out my Anime Store - bit.ly/3rXvlqk
    Subscribe to my channel so that you do not miss any topic.
    The phone I used to record - amzn.to/34V1uqX
    Phone stand used - amzn.to/3igP9QZ
    Lighting I used - amzn.to/3IpYyQO
    My laptop - amzn.to/3L1gt1Z
    My gaming Keyboard - amzn.to/3Jt66mY
    My gaming Mouse - amzn.to/36B4eKE
    Headphones - amzn.to/3u3RnbC
    My other videos-
    Finding Reverse of a Number - • Finding Reverse of a N...
    Check if the given number is Prime Number - • Check if given number ...
    Finding Minimum and Maximum value from an Array - • Finding Minimum and Ma...
    Area and Perimeter of Rectangle - • Area and Perimeter of ...
    Program to check if a string is Palindrome - • Palindrome | Program ...
    Find sum of digits of a number - • Find sum of digits of ...
    Count the number of Digits of a Number - • Count the number of Di...
    Java program to print Fibonacci Series - • Java program to print ...
    Find Factorial of a number - • Find Factorial of a nu...
    Check if a given year is Leap Year - • Check if a given year...
    C++ program to Swap two numbers (Using extra variable) - • C++ program to Swap tw...
    C++ program to find if a number is ODD or EVEN - • C++ program to find if...
    C++ program to find Quotient and Remainder - • C++ program to find Qu...
    C++ program to find Sum, Difference, Product, and Divison of two numbers - • C++ program to find Su...

ความคิดเห็น • 38

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

    Thank you so much for posting this video ☺️ hoping for more videos from this channel

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

    Thank you bro the program helped me..

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

    Great explanation! Thank you so much.

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

    Plz send the code bro actually its not working code

  • @hogwartsexpress19
    @hogwartsexpress19 10 หลายเดือนก่อน +3

    this program only remove the duplicates but we need unique value ex in this array 5 and 7 are the unique values

    • @Jenasuraj
      @Jenasuraj 4 หลายเดือนก่อน

      Agree🎉

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

    clear explanation 😇

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

    What is time complexity this way?

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

    Bro kindly do a video regarding split an array into 2 and merge 2 array into 1

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

    thank you

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

    loving your channel ....sir please upload max ANd min salary program also

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

      Can u post the exact question here, so that I can take a look

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

      @@BTechComputerScience sir this one is done. by seeing you max and min value program......can you please upload " reservse a string using different concepts " and can we do that without using inbuild methods ? thank you

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

    Bro while writing the program u haven’t sort the arrays .. actually we should add arrays.sort method before writing for loop right bro ?

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

    Good

  • @toff2.024
    @toff2.024 7 หลายเดือนก่อน

    you're awesome wow

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

    Bro what if no district elements are found in given 🤔 array ....??(u have specify that case also )

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

      wym no distinct element you mean all of em are duplicate? Then the program will print elements. I think the purpose of his program is to delete duplicate numbers for example If I put 1, 1, 2, 2, 3, 3 in the array it will print 1,2,3

    • @RamanKishore-qe6jb
      @RamanKishore-qe6jb 6 หลายเดือนก่อน

      You are correct​@@noisyintrovertzxc

  • @Waste_fellow.w
    @Waste_fellow.w ปีที่แล้ว

    Bro put a[lst index ] in outer for loop

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

    Can u please post video how to solve this question. In an array u have to identify the unique pairs which is sum of 11 and print. a={1,3,5,6,10,7,4,3}. I never seen any videos for this video

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

      Is this what u have been looking for? th-cam.com/video/u9Ts04Ez8fw/w-d-xo.html

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

      @@BTechComputerScience thanks

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

      Also I have another scenario like in the given string s=tomorrow we have to replace the second occurrence of O with *.

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

      @@vigneshr643 try this approach-
      Keep a flag variable false. Traverse the array using for loop, when u find a O, change flag to true, now when flag is true and u find a O, change it to *

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

      @@BTechComputerScience ok but I have to replace only the second occurrence of O

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

    Sir code m Correct answer nahe aa raha hai

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

      Can u share the code here? Or have u figured it out yourself?

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

      Yes it is printing with no duplicates

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

      Before posting a video you should try your own code in eclipse. It’s not giving the right answer.

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

    not a good way !

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

    import java.util.*;
    public class Main
    {
    public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int []a=new int[n];
    for(int i=0;i

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

      Yes, let's consider the sorted array [1,1,2,2,3], clearly '1' has appeared 2 times, but ur code will see that the second element '1' and third element '2' are not same and will print '1' which is wrong

    • @user-pp4cf3hq9w
      @user-pp4cf3hq9w หลายเดือนก่อน

      @@BTechComputerScience you have given the wrong code, your code will not aat all print distinct values. check once, your code doesnt match the thumbnail.

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

    wrong way to solving this problem, before posting any video try to do on its on