上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页
摘要: import org.junit.Test; import java.util.*; public class leetcode695 { int[] par = new int[100005]; int[] rak = new int[100005]; int[] dx = {0,1,0,-1}; 阅读全文
posted @ 2021-08-07 17:52 Peterxiazhen 阅读(52) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Main { static int[] vis = new int[100005]; static int[] dis = new int[100005]; static int n; static int m; public sta 阅读全文
posted @ 2021-08-06 22:28 Peterxiazhen 阅读(30) 评论(0) 推荐(0) 编辑
摘要: package com.itheima.controller;import java.util.*;public class leetcode652 { // 定义树节点 static class TreeNode { int val; TreeNode left; TreeNode right; 阅读全文
posted @ 2021-08-05 11:35 Peterxiazhen 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 这道题考察了dp、前缀树、回溯等知识,下面给出代码 class Solution { class TrieNode { String word = null; HashMap<Character, TrieNode> map = new HashMap<>(); public TrieNode() 阅读全文
posted @ 2021-07-13 15:16 Peterxiazhen 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 力扣208.实现一棵前缀树 class Trie { // 前缀树的节点 class TrieNode { boolean isWord = false; // 表示该节点是否是单词的最后一个字符 TrieNode[] children; public TrieNode() { children = 阅读全文
posted @ 2021-07-10 12:12 Peterxiazhen 阅读(47) 评论(0) 推荐(0) 编辑
摘要: public int calculate(String s) { int len = s.length(); Stack<Integer> s1 = new Stack<>(); // 操作数栈 int num = 0; char preSign = '+'; // 为了方便计算,1+1+1 > + 阅读全文
posted @ 2021-07-07 11:22 Peterxiazhen 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 连接 阅读全文
posted @ 2021-07-06 15:37 Peterxiazhen 阅读(30) 评论(0) 推荐(0) 编辑
摘要: // leetcode 179. class Solution { // 使用Comparator比较器(自定义比较器) Comparator comparator1 = (o1, o2) -> { if (o1 instanceof Integer && o2 instanceof Integer 阅读全文
posted @ 2021-07-06 15:34 Peterxiazhen 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 一、数字转字符串 1、通过ToString() 方法, Double 就是一个包装类,String s1 = Double.toString(num); Integer同理 2、通过valueof() 方法, 本质上还是调用 toString() 方法,String s2 = String.valu 阅读全文
posted @ 2021-07-06 10:18 Peterxiazhen 阅读(4753) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int longestSubstring(String s, int k) { int len = s.length(); return dfs(s, 0, len-1, k); } public int dfs(String s, int l, in 阅读全文
posted @ 2021-07-05 10:44 Peterxiazhen 阅读(29) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页