Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Encoding
- {
- public static Set<String> morseCodes(int m, int n)
- {
- Set<String> result = new TreeSet<>();
- if (m == 0 && n ==0){
- result.add(" ");
- }
- else if (m == 1 & n == 0){
- result.add(".");
- }
- else if (m == 0 & n == 1){
- result.add("-");
- }
- else{
- Set<String> subresult1 = morseCodes(m-1, n);
- Set<String> subresult2 = morseCodes(m, n-1);
- for(String str: subresult1){
- }
- for(String str : subresult2){
- }
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement