kedarsdixit
BAN USERTry using Apache Mahout, this can help to build one of the good solution.
~Kedar
Both are correct, Ideally we should use 1st one.
- kedarsdixit December 10, 2013No
- kedarsdixit December 02, 2013Yes its absolutely correct. :)
- kedarsdixit December 02, 2013public class FindingFirstDuplicateElement {
/**
* @param args
*/
public static void main(String[] args) {
int[] data = { 4, 3, 1, 2, 5, 9, 5, 4 };
Map<Integer, Integer> lookup = new HashMap<Integer, Integer>();
for (int temp : data) {
if (lookup.containsKey(temp)) {
System.out.println(temp);
} else {
lookup.put(temp, 1);
}
}
}
}}
- kedarsdixit November 26, 2013Assuming you have an Dictionary technically a map
For 1st case :
a. Take out all the keys.
b. for each key get the value from map. Recursively iterate through the key and value to find the pairs with no common letter.
For 2nd Case:
a. Compute totalLength = key.length * value.length;
b. Maintain one more map with key as totalLength and value as List of keys.
c. at the end dump the values of largest key.
Please find below java implementation:
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class RemoveDuplicatesFromString {
public static void main(String[] args) {
String inputString = "";
String outputString = "";
Map<Character, Integer> dictionary = new HashMap<Character, Integer>();
Scanner sc = new Scanner(System.in);
System.out.println("Please Ente String:");
inputString = sc.nextLine();
for (int i = 0; i < inputString.length(); i++) {
if (!dictionary.containsKey(inputString.toLowerCase().charAt(i))) {
dictionary.put(inputString.toLowerCase().charAt(i), 1);
outputString += inputString.charAt(i);
}
}
System.out.println(outputString);
}
}
Please find below java implementation :
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class RemoveDuplicatesFromString {
public static void main(String[] args) {
String inputString = "";
String outputString = "";
Map<Character, Integer> dictionary = new HashMap<Character, Integer>();
Scanner sc = new Scanner(System.in);
System.out.println("Please Ente String:");
inputString = sc.nextLine();
for (int i = 0; i < inputString.length(); i++) {
if (!dictionary.containsKey(inputString.toLowerCase().charAt(i))) {
dictionary.put(inputString.toLowerCase().charAt(i), 1);
outputString += inputString.charAt(i);
}
}
System.out.println(outputString);
}
}
Following are few differences between Arrays and linked List :
# Arrays can be traversed randomly where as linked list traversal is sequential.
# While creating array one has to specify the size,Where as Linked list can grow dynamically.
# Memory allocation for an array is compile time and where as for Linked list it is Run time.
Please find Implementation in java:
Code is as below:
public class HashTableDemo {
public static void main(String[] args) {
Hashtable<Integer, String> rollNumberName = new Hashtable<Integer, String>();
System.out.println("Starting The Demo\n\n");
rollNumberName.put(1, "ABC");
rollNumberName.put(2, "DEF");
rollNumberName.put(3, "GHI");
System.out.println("Initially In HashTable: " + rollNumberName);
System.out.println("Adding new value to existing key-1 : "
+ rollNumberName.put(1, "XYZ"));
System.out
.println("\nAfter replacing the value for key-1 in HashTable: "
+ rollNumberName);
}
Output will be as below :
---------------------------------
Starting The Demo
Initially In HashTable: {3=GHI, 2=DEF, 1=ABC}
Adding new value to existing key: ABC
After replacing the value for key 1 in HashTable: {3=GHI, 2=DEF, 1=XYZ}
1) Read input.
2) Split it by Space as a delimiter.
3)Print the splits in reverse order.
HI There,
Write your own utility that will read line by line and split each line by a "," as a delimiter.
Then consider the column index to get each token.
Hope this will help.
~k
{
class Card{
String cardType;
int number;
}
for CardType we can use enum.
and to create 52 cards we can have Set<Card> packOfCards
}
Decrement the "end" variable.
- kedarsdixit August 26, 2013Possible Reasons of failing :
1)No flash player installed
2)Video file corrupted/unavailable
3)page might be in HTML-5
Possible solutions:
1)Use Firebug if you are using FF/any other debugger.
2)Check the web-service call is proper/not.
3)Ensure your browser's version is latest and compatible with all latest technologies.
4)Check out the logs from debugger.
If everything is fine restart the system ;)
c
- kedarsdixit April 09, 2013LCA
- kedarsdixit April 04, 2013Primitive data types are stored in stack unless they are part of an object.Objects/instances are stored on heap and if Objects/Instances contains primitive data types then in this case primitive data types are stored on heap
- kedarsdixit April 04, 2013Primitive data types are stored in stack unless they are part of an object.Objects/instances are stored on heap and if Objects/Instances contains primitive data types then in this case primitive data types are stored on heap.
- kedarsdixit April 04, 2013
Repfanniepaisley, Computer Scientist at ABC TECH SUPPORT
Fannie Parsley, and I'm working as a Cartographer. And nowadays I am doing a new experiment on best tantrik ...
Repaleasebkern, Personnel
Plant operators manage all things in an industrial plant or a power plant . They are supervising all the work . For ...
RepMariaBJiles, Accountant at A9
I am working as a team leader in a development software company. I am creative in learning how to crochet ...
Repstacimdalton, Dev Lead at ASAPInfosystemsPvtLtd
At the moment I'm implementing Slinkies in the financial sector. My current pet project is researching break up a ...
RepViennaJones, Reporter at Precious Moments
Experienced project manager and capable supervisor of a team of writers, reporters, illustrators, graphic artists, and other staff members. I ...
Code is as below-
Sample Input and Output-
- kedarsdixit July 16, 2014Enter A String
Enter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A StringEnter A String
{A=28, String=1, Enter=1, StringEnter=27}
28