Ambreen Khanam

Greenhorn
+ Follow
since Apr 18, 2013
Merit badge: grant badges
For More
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 Ambreen Khanam

Hi..Can you please provide em the optimised sollution for the below problem.

There are 3 sorted arrays say. A[1,3,5,7,9....99] B[2,4,6,8,..100] C[5, 10,15, 20...95]

The output should be 99, 100, 95
10 years ago
Thanks Ritchie..

Are you talking about this example.

import java.util.*;

public class Freq {
public static void main(String[] args) {
Map<String, Integer> m = new HashMap<String, Integer>();

// Initialize frequency table from command line
for (String a : args) {
Integer freq = m.get(a);
m.put(a, (freq == null) ? 1 : freq + 1);
}

System.out.println(m.size() + " distinct words:");
System.out.println(m);
}
}
10 years ago
Hi,
Can anyone provide the optimised soln for this problem.
in an array say there are elements like A[1, 2, 4, 5, 4, 2, 1, 2]. How to caculate the frequency of each number and also print the no with the highest frequency.

This problem needs to be solved using hash map.
10 years ago
Please provide me the best optimised solution for the below problem.

Say there is an array Array[1,2,3,4,5,6,7,8]. The elements needs to be swapped from index 0 to 4. The output should be somethin like this.

5,4,3,2,1,6,7,8
10 years ago