Advertisement
Guest User

Untitled

a guest
Aug 26th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Encoding
  4. {
  5. public static Set<String> morseCodes(int m, int n)
  6. {
  7. Set<String> result = new TreeSet<>();
  8. if (m == 0 && n ==0){
  9. result.add(" ");
  10. }
  11.  
  12. else if (m == 1 & n == 0){
  13. result.add(".");
  14. }
  15.  
  16. else if (m == 0 & n == 1){
  17. result.add("-");
  18. }
  19.  
  20. else{
  21. Set<String> subresult1 = morseCodes(m-1, n);
  22. Set<String> subresult2 = morseCodes(m, n-1);
  23.  
  24. for(String str: subresult1){
  25. }
  26.  
  27. for(String str : subresult2){
  28.  
  29. }
  30. }
  31. return result;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement