Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!

Johannes Smitth

Greenhorn
+ Follow
since Mar 10, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Johannes Smitth

Hi, does anyone has an experience with burp suit setup.
1 month ago
What do I need to change so the player who takes the last one become a winner.

2 months ago
Thanks, the issue has been resolved for a month now. Still thanks for helping me!
2 months ago

Liutauras Vilda wrote:

Junilu Lacar wrote:How do you break the tie and pick 'a' as "the most frequently occurring" in this case?


I think that is because 'a' occurs most frequently last if there are other element(s) which occur the same amount of times. But OP needs to clarify indeed, as I don't get from the quote below where that 'h' came from while we were talking about 'a'.

OP wrote:output: "aaa" because the element h is in a higher position than the other characaters.



Exactly, it must read from a-z and print out the char with highest order. Forget that h, it was a typing error.
3 months ago
import java.util.HashSet;

public class proge21 {
   public static void main(String[] args) {
       char[] arr = {'A', 'B', 'C', 'A', 'B','B'};

       HashSet<Character> hset = new HashSet<Character>();

       for (int i = 0; i < arr.length; i++) {
           hset.add(arr[i]);
       }

       Object[] ObjChar = hset.toArray();

       char[] resultArr = new char[ObjChar.length];

       for (int j = 0; j < ObjChar.length; j++) {

           resultArr[j] = (char) ObjChar[j];
       }
I am stuck with sorting
3 months ago
Which function help me to sort the string in alphabetical order?

find most occuring character("blablabla")
remove most occuring("aaa")
input: blablabla
output: "aaa" because the element h is in a higher position than the other characaters.
3 months ago