fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Student {
  8. int id;
  9. public int getId(){
  10. return this.id;
  11. }
  12. }
  13.  
  14. class InterviewFunctions{
  15.  
  16. public HashMap<Integer, Student> buildMap(Student[] students){
  17. HashMap<Integer, Student> map = new HashMap<Integer, Student>();
  18. for (Student s : students) {
  19. map.put(s.getId(), s);
  20. }
  21. return map;
  22. }
  23.  
  24. public ArrayList merge(String[] words, String[] moreWords){
  25. ArrayList<String> sentance = new ArrayList<String>();
  26. for(String word : words) sentance.add(word);
  27. for(String word : moreWords) sentance.add(word);
  28. return sentance;
  29. }
  30.  
  31. public String joinWords(String[] words){
  32. StringBuffer sentance = new StringBuffer();
  33. for(String word : words){
  34. sentance.append(word);
  35. }
  36. return sentance.toString();
  37. }
  38.  
  39.  
  40. //Implement an algorithem to see if a String has all unique characters
  41.  
  42. public Boolean containsAllUnique(String testString){
  43. for(int i=0; i<testString.length(); i++){
  44. for(int k=i+1; k<testString.length(); i++){
  45. if (testString.charAt(i) == testString.charAt(k)) return false;
  46. }
  47. }
  48. return true;
  49. }
  50.  
  51.  
  52. public String reverse(String forwardString){
  53. return "";
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60. }
  61.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
spoj: The program compiled successfully, but main class was not found.
      Main class should contain method: public static void main (String[] args).
stdout
Standard output is empty