iamkake
BAN USER
- Create a mapping between entry (string?) and int
- Go through the list and for each increment the int by 1 so at the end you have a count of everything
- Go through the mapping you made and for each if there is only 1, print it out, if there is more than 1 print it out the number in the mapping minus 1
public string[] filter(string[] everything)
{
if (everything == null || everything.length < 2) { return everything; }
HashMap<string,int> counts = new HashMap<string,int>();
for (int i = 0 ; i < everything.length; i++)
{
if (counts.containsKey(everything[i]))
{
counts.put(everything[i],counts.get(everything[i]) + 1);
}
else {
counts.put(everything[i], 1);
}
}
List<string> finalList = new ArrayList<string>();
for (Map.Entry<string, int> entry : map.entrySet()) {
int times = entry.getValue();
if (times == 1) {
finalList.add(entry.getKey());
}
else {
for (int i = 0; i < times - 1; i++)
{
finalList.add(entry.getKey());
}
}
}
string[] arrayFinal = new string[finalList.size()];
finalList.toArray(arrayFinal);
return arrayFinal;
}
RepOwenKary, Analyst at ASU
I am an experienced software engineer with a passion for java developing innovative programs that expedite the efficiency and effectiveness ...
RepRitterNicole, DIGITAL MARKETING at Arista Networks
I am Ritter, Experimental psychologist refers to work done who apply experimental methods to psychological study and the processes that ...
Repgladysloweg, Brokerage clerk at Bell Markets
I am Gladys from Defiance city . I am working as a Brokerage clerk with tasks associated with securities such as ...
RepZairaMoore, Accountant at AMD
I am an ambitious and promising young chef with culinary education and prestigious intern and entry-level work experience. I trained ...
RepIvyWeir, HTML Freshers at Clean Power Research
Ivy , an Empathetic and passionate Psychology student with experience in performing psychological patient assessments, assisting in psychotherapy, monitoring patients' progress ...
RepEddieCody, abc at A9
I am a creative freelance graphic designer with over 3 years of experience in developing engaging and innovative digital and ...
RepEzraDavis, abc at A9
I am a hardworking and disciplined newly-certified architect with internship experience in designing commercial buildings and creating accurate 2D and ...
RepAriAllen, AT&T Customer service email at ABC TECH SUPPORT
I have experience with collecting data and conducting experiments for studies in a variety of industries. I am a respected ...
RepCindybilly, Animator at Absolute Softech Ltd
Cindybilly, an Addictions nurse with the experience of 10 years . A substance abuse nurse provides direct patient care to individuals ...
RepOishiGreen, Android test engineer at ABC TECH SUPPORT
I am a results-oriented debt collector with 3 years of experience and knowledge in the leasing/finance sector. I have ...
RepArnoldTate, Title searcher at Keeney's
I am a Title searcher with 8+ years of experience . In real estate business and law, a title search or ...
RepBrezaLoni, Health inspector at Chess King
I am Health inspector from Memphis, USA .My work involves inspecting restaurants, schools, public pools, nursing homes, and daycare centres ...
and the only column is a1 and a2??
- iamkake April 30, 2014