上一页 1 2 3 4 5 6 ··· 15 下一页
摘要: #include <bits/stdc++.h> using namespace std; const int N = 100010, M = 1000010; int ne[N]; char s[M], p[N]; int n, m; int main() { cin >> n >> p + 1 阅读全文
posted @ 2020-09-03 11:42 Sexyomaru 阅读(182) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 100010, M = 3000300; int son[M][2], a[N], idx; int n; void insert(int x) { int p = 0; for( 阅读全文
posted @ 2020-09-03 11:09 Sexyomaru 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int N = 300000; int son[N][26], cnt[N], idx; int n; char str[N]; void insert(char *str) { int p = 阅读全文
posted @ 2020-09-03 11:08 Sexyomaru 阅读(167) 评论(0) 推荐(0) 编辑
摘要: public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 商品数 // 背包大小 int n = sc.nextInt(), m = sc.nextInt( 阅读全文
posted @ 2020-09-02 16:23 Sexyomaru 阅读(166) 评论(0) 推荐(0) 编辑
摘要: class Solution { int[] p; int[] s; public int largestIsland(int[][] grid) { if(grid.length == 0) return 0; int n = grid.length, m = grid[0].length; p 阅读全文
posted @ 2020-09-02 11:03 Sexyomaru 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 方法一:树状数组 class NumArray { int[] nums; int[] bitArr; int n; public NumArray(int[] nums) { n = nums.length; this.nums = nums; bitArr = new int[n+1]; for 阅读全文
posted @ 2020-09-01 15:36 Sexyomaru 阅读(148) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List<Integer> findMinHeightTrees(int n, int[][] edges) { List<Integer> res = new ArrayList<>(); if (n == 1) { res.add(0); retu 阅读全文
posted @ 2020-09-01 15:23 Sexyomaru 阅读(129) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void moveZeroes(int[] nums) { int n = nums.length; for(int i = 0, j = 0; i < n; i++) { if(nums[i] != 0) { int t = nums[i]; num 阅读全文
posted @ 2020-08-29 15:39 Sexyomaru 阅读(99) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<int> diffWaysToCompute(string input) { vector<int> res; int n = input.size(); for(int i = 0; i < n; i++) { char c = in 阅读全文
posted @ 2020-08-28 20:58 Sexyomaru 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 方法一:记忆化dfs class Solution { boolean[][] visited; public boolean containsCycle(char[][] grid) { int m = grid.length, n = grid[0].length; visited = new 阅读全文
posted @ 2020-08-27 17:42 Sexyomaru 阅读(167) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 15 下一页