Frequency of each element in an integer array | Brute force | JAVA interview question
ฝัง
- เผยแพร่เมื่อ 19 ธ.ค. 2021
- Frequency of each element in an integer array using Brute force technique. O(n^2)
JAVA interview question
#JAVA - วิทยาศาสตร์และเทคโนโลยี
thanks
Well explained
i have doubt related that you have print elements and their frequency for unique elements that not visited but what about that elements that stored in freq[j] how they print?
very well explained. Thanks, but still i have a confusion on why we have stored visited in arr[j] ??
We have set freq[j] = visited....because we have already updated the count of that element(freq[j]) and we dont want to visit that element again
Otherwise same element's frequency will be updated again and again and it wont provide the required result.
very Awesome explaination.
Thank you!
How to do it if time complexity O(N) using brute force
th-cam.com/video/pzQvKGcze3A/w-d-xo.html
Checkout this video
@@TechnosageLearning yeah i hve checked out this but the concept of has map isn't thought to us yet so i was asking if there was any other way
why visited = -1?
what will happen if the give array has value of visited that is "-1"
it will not print(exclude)
which screen recorder u r using??
Default Mac screen capture tool
Well explained mam 👍
Thank you😊
same as the code in the internet
8
2 0 1 1 1 0 3 1
ans=2 4 1 1
code output=2 4 1 0
how can i handle this case
after sorting array