摘要:
JAVA DP: public final boolean wordBreak(String s, List<String> wordDict) { Set<String> set = new HashSet<String>(); for (String word : wordDict) set.a 阅读全文
摘要:
JAVA DP: public final int shoppingOffers(List<Integer> price, List<List<Integer>> special, List<Integer> needs) { Map<String, Integer> cache = new Has 阅读全文
摘要:
JAVA: public final ListNode partition(ListNode head, int x) { ListNode leftHead = new ListNode(), rightHead = new ListNode(), left = leftHead, right = 阅读全文
摘要:
JAVA: public final List<String> findLadders(String beginWord, String endWord, List<String> wordList) { List<String> re = new LinkedList<String>(); Set 阅读全文
摘要:
JAVA 暴力(BFS): public final int[] findBall(int[][] grid) { int len = grid[0].length; int[] balls = new int[len]; for (int i = 0; i < balls.length; i++) 阅读全文
摘要:
贪心 JAVA: public final int minFlips(String target) { int len = target.length(), num = 0; for (int i = 0; i < len; i++) { char curr = num % 2 == 0 ? '0' 阅读全文
摘要:
JAVA: public final int numWaterBottles(int numBottles, int numExchange) { int re = numBottles, empty = numBottles; while (empty >= numExchange) { int 阅读全文