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...
Thank you so much for posting this video ☺️ hoping for more videos from this channel
Thank you bro the program helped me..
Great explanation! Thank you so much.
Hey thanks!
Plz send the code bro actually its not working code
this program only remove the duplicates but we need unique value ex in this array 5 and 7 are the unique values
Agree🎉
clear explanation 😇
What is time complexity this way?
Bro kindly do a video regarding split an array into 2 and merge 2 array into 1
thank you
loving your channel ....sir please upload max ANd min salary program also
Can u post the exact question here, so that I can take a look
@@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
Bro while writing the program u haven’t sort the arrays .. actually we should add arrays.sort method before writing for loop right bro ?
yes
Good
you're awesome wow
Bro what if no district elements are found in given 🤔 array ....??(u have specify that case also )
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
You are correct@@noisyintrovertzxc
Bro put a[lst index ] in outer for loop
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
Is this what u have been looking for? th-cam.com/video/u9Ts04Ez8fw/w-d-xo.html
@@BTechComputerScience thanks
Also I have another scenario like in the given string s=tomorrow we have to replace the second occurrence of O with *.
@@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 *
@@BTechComputerScience ok but I have to replace only the second occurrence of O
Sir code m Correct answer nahe aa raha hai
Can u share the code here? Or have u figured it out yourself?
Yes it is printing with no duplicates
Before posting a video you should try your own code in eclipse. It’s not giving the right answer.
not a good way !
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
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
@@BTechComputerScience you have given the wrong code, your code will not aat all print distinct values. check once, your code doesnt match the thumbnail.
wrong way to solving this problem, before posting any video try to do on its on