摘要:
贪心 import java.util.Arrays; class Solution { public int findContentChildren(int[] g, int[] s) { /** * 贪心算法 * 将胃口大小和饼干大小排序,按照最大的饼干给最大的胃口的原则,依次分配饼干 * 如果 阅读全文
posted @ 2022-01-17 21:07
振袖秋枫问红叶
阅读(40)
评论(0)
推荐(0)
摘要:
回溯 class Solution { public void solveSudoku(char[][] board) { backtracking(board); } public boolean backtracking(char[][] board) { /** * 递归遍历每个空位放9个数字 阅读全文
posted @ 2022-01-17 17:43
振袖秋枫问红叶
阅读(37)
评论(0)
推荐(0)
摘要:
回溯 import java.util.Arrays; class Solution { int sum = 0; public int totalNQueens(int n) { /** * 使用二维数组存储棋盘,最后再转换为列表 * 默认填充'.' */ char[][] chars = new 阅读全文
posted @ 2022-01-17 15:27
振袖秋枫问红叶
阅读(34)
评论(0)
推荐(0)
摘要:
深度优先搜索 import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.List; class Solution { int m; int n; int[][] 阅读全文
posted @ 2022-01-17 14:21
振袖秋枫问红叶
阅读(55)
评论(0)
推荐(0)

浙公网安备 33010602011771号