This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dojo.java8.tutorials.hashmap; | |
import java.util.Map; | |
import java.util.stream.Collectors; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.LinkedHashMap; | |
public class HashMapSortingByKeys { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dojo.java8.tutorials.hashmap; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.stream.Collectors; | |
public class HashMapSortingByValues { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. word break 1 | |
public boolean dfs(String s, List<String> wordDict) { | |
return dfs(s, new HashSet<>(wordDict), 0); | |
} | |
public boolean dfs(String s, Set<String> wordDict, int start) { | |
if (start == s.length()) { | |
return true; | |
} | |
for (int end = start + 1; end <= s.length(); end++) { |
OlderNewer