- 博客(201)
- 资源 (1)
- 收藏
- 关注

原创 动态规划集锦
问题1:方法一:方法二:本人的JAVA实现:方法三:问题2:问题3:方法一:方法二:最大收益的买卖时间暂时还没搞定,未完待续。问题四:方法一:方法二:方法三:本人的JAVA尝试:问题5:方法一...
2019-03-26 18:46:10
406
3
转载 k8s的容器运行时架构
容器运行时(ContainerRuntime),运行于 kubernetes(k8s)集群的每个节点中,负责容器的整个生命周期。其中dockershim是目前应用最广的容器运行时,随着容器云的发展,越来越多的容器运行时涌现。为了解决这些容器运行时和 k8s 的集成问题,在 k8s1.5 版本中,社区推出了 CRI(ContainerRuntimeInterface,容器运行时接口),以支持更多的容器运行时。下图是k8s的容器运行时架构:下图是k8s中容器运行时的执行逻辑:CRI是kube
2021-11-12 16:57:06
1155
转载 kube-scheduler调度启动流程与算法
kube-scheduler 类似于kube-apiserver,是个常驻进程,查看其对应的Run函数。func runCommand(cmd *cobra.Command, opts *options.Options, registryOptions ...Option) error { // 根据入参,返回配置cc与调度sched cc, sched, err := Setup(ctx, opts, registryOptions...) // 运行 return Run(ctx,
2021-11-12 16:54:19
588
原创 canal 索引建立
cd /etc/mysql/mysql.conf.dvim mysqld.cnf#新增开启bin_logserver-id = 1binlog_format = ROWlog_bin = mysql_binsystemctl restart mysqlmysql -u root -p123456mysql>show variables like 'log_...
2020-03-08 17:38:19
322
原创 logstash
下载logstash包 解压bin/logstash-plugin install logstash-input-jdbccd binmkdir mysql(新建目录)把mysql-connector-java-5.1.34.jar拷贝到mysql目录下新建两个文件 jdbc.conf jdbc.sqlinput { jdbc { # mysq...
2020-03-06 16:57:49
196
原创 elasticSearch语法
PUT /employee{ "settings": { "number_of_shards": 1, "number_of_replicas": 1 }}DELETE /employee//非结构化方式新建索引PUT /employee/_doc/1{ "name": "凯杰2", "age": 28}PUT /employee/_doc/...
2020-03-02 20:06:24
176
原创 elasticSearch
安装版本是7.3.0elasticSearch 和 kibana两个问题一个是修改内存参数config/jvm.options改的小一点一个是在root用户下无法启动es我们需要添加用户。adduser sjj //添加用户sjjpasswd *** //给用户赋值123456添加完用户之后:用root用户执行 : chown -R 用户名文件...
2020-03-01 20:00:45
156
原创 多级缓存策略
使用guava cache在本地缓存热点数据某些热点数据在短时间内可能会被成千上万次访问,所以除了放在redis之外,还可以放在本地内存,也就是JVM的内存中。我们可以使用google的guava cache组件实现本地缓存,之所以选择guava,是因为它可以控制key和value的大小和超时时间,可以配置LRU策略且guava是线程安全的。首先引入guava cache。&...
2020-02-19 13:57:51
417
原创 数据结构3
1.hash表拉链法import java.io.*;public class Main{ static int N = 100010; static int[] h = new int[N]; static int[] e = new int[N]; static int[] ne = new int[N]; static int idx;...
2020-01-29 20:55:48
148
原创 数据结构2
1.并查集import java.io.*;public class Main{ static int N = 100010; static int[] p = new int[N]; static int m; static int n; static int find(int x){ if(p[x]!=x) p[x]=find(...
2020-01-29 01:10:40
155
原创 数据结构
1.单链表import java.io.*;public class Main { static int N = 100010; static int head; static int idx; static int[] e = new int[N]; static int[] ne = new int[N]; static void ...
2020-01-28 01:13:00
137
原创 搜索与图论
import java.util.Scanner;public class Main { static int n; static int[] path; static boolean[] st; public static void main(String[] args) { Scanner sc = new Scanner(System...
2020-01-27 00:40:13
259
原创 LeetCode 51 N-Queens 52 N-Queens II
class Solution { char[][] g; boolean[] row,col,dg,udg; List<List<String>> res = new ArrayList<>(); public List<List<String>> solveNQueens(int n) { ...
2020-01-26 22:20:51
101
原创 数据结构
1.Two Sumclass Solution { public int[] twoSum(int[] nums, int target) { int[] res = new int[2]; Map<Integer,Integer> map = new HashMap<>(); for(int i=0;i<...
2020-01-24 00:34:39
188
原创 滑动窗口、双指针、单调队列和单调栈
167.Two Sum II - Input array is sortedclass Solution { public int[] twoSum(int[] numbers, int target) { int[] res = new int[2]; int i=0,j=numbers.length-1; while(i<j...
2020-01-22 00:46:06
268
原创 动态规划
53.Maximum Subarrayclass Solution { public int maxSubArray(int[] nums) { int res=0; int max=Integer.MIN_VALUE; for(int i=0;i<nums.length;i++){ if(res<...
2020-01-20 23:39:54
141
原创 字符串
38.Count and Sayclass Solution { public String countAndSay(int n) { StringBuilder s=new StringBuilder("1"); for(int i=0;i<n-1;i++){ StringBuilder sb = new String...
2020-01-20 01:38:04
170
原创 Tree
98.Validate Binary Search Treeclass Solution { public boolean isValidBST(TreeNode root) { return dfs(root,Integer.MIN_VALUE,Integer.MAX_VALUE); } public boolean dfs(Tre...
2020-01-19 03:16:31
137
原创 链表
19.Remove Nth Node From End of Listclass Solution { public ListNode removeNthFromEnd(ListNode head, int n) { ListNode dummy =new ListNode(-1); dummy.next=head; ListNode...
2020-01-18 02:58:31
138
原创 二分
模版一:绿色的target模版二:红色的target69.Sqrt(x)class Solution { public int mySqrt(int x) { int l=0,r=x; while(l<r){ int mid= l+r+1>>1; if(mid<=x/...
2020-01-17 19:52:41
139
原创 git
在这个目录下 ssh-keygen -t rsa -C "13506235021@163.com"然后去找然后拷贝密钥到github修改ssh.exe为
2019-12-11 18:25:57
92
原创 redis 安装
下载安装包chmod -R 777 redis-5.0.7.tar.gztar -zxvf redis-5.0.7.tar.gzcd redis-5.0.7/makemake installcd src/./redis-server &./redis-cli
2019-12-08 21:56:32
79
原创 安装OpenResty
下载包openresty-1.13.6.2.tar.gzchmod -R 777 openresty-1.13.6.2.tar.gztar -zxvf openresty-1.13.6.2.tar.gzcd openresty-1.13.6.2/预先安装 apt-get install libpcre3-dev\ ...
2019-12-08 00:37:28
156
原创 mysql 安装
apt-get install mysql-servery123456whereis mysqlcd /etc/mysql/conf.dcat mysqldump.cnf修改16M(改大一点)cd /etc/mysql/mysql.conf.dvim mysqld.cnfcd /var/lib/mysql(数据库存放位置)cd/etc/mys...
2019-12-06 16:27:48
178
原创 JAVA 安装
1.tar包传输cd /root/softtar -zxvf jdk-8u-...mkdir /usr/local/java/mv jdk-1.8.... /usr/local/java/vi /etc/environment追加三行export JAVA_HOME=/usr/local/java/jdk1.8.0_152export JRE_HO...
2019-12-06 16:00:22
110
原创 安装Ubuntu母机
修改ssh配置文件,设置为允许root远程登录:root@ubuntu:~# vim /etc/ssh/sshd_config将PermitRootLogin prohibie-password 修改为:PermitRootLogin yes 即可。保存退出,重启ssh服务:root@ubuntu:~# /etc/init.d/ssh restart再次尝试ssh 远程登录,成功登录...
2019-12-06 15:30:16
134
原创 消费者生产者模式
1.synchronized——wait——notifyAll组合public class ConsumerDemo2 { public int number = 0; //public Lock lock = new ReentrantLock(); //public Condition condition = lock.newCondition(); p...
2019-10-31 11:54:50
106
原创 Spring Bean的作用域
目前Spring Bean的作用域或者说范围主要有五种。作用域 描述singleton 在springIoC容器仅存在一个Bean实例,Bean以单例方式存在,bean作用域范围的默认值。prototype 每次从容器中调用Bean时,都返回一个新的实例,即每次调用getBean()时,相当于执行newXxxBean()。request 每次HTTP请求...
2019-10-12 19:50:49
134
原创 异常
Exception:是程序本身可以处理的异常Error:是程序无法处理的错误,这些错误标识故障发生于虚拟机自身或者发生在虚拟机试图执行应用时,一般不需要程序处理,例如:内存空间不足,栈溢出Error类和Exception类都继承自Throwable类。二者的不同之处:Exception:1.可以是可被控制(checked) 或不可控制的(unchecked)。2.表示一个由程...
2019-10-12 19:32:57
111
原创 排序
package Day3;import java.util.Arrays;public class Sort { public static void main (String[] args){ int[] a={3,1,5,7,2,4,9,6}; int[] b={6,8,7,9,0,1,3,2,4,5}; int[] c={5,...
2019-09-24 00:57:04
110
原创 107. Binary Tree Level Order Traversal II
class Solution { public List<List<Integer>> levelOrderBottom(TreeNode root) { LinkedList<List<Integer>> res=new LinkedList<>(); if(root==null) retu...
2019-09-23 10:51:08
121
原创 144. Binary Tree Preorder Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { p...
2019-09-23 10:45:26
74
原创 102. Binary Tree Level Order Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { p...
2019-09-23 10:18:37
82
原创 72. Edit Distance
class Solution { public int minDistance(String word1, String word2) { if (word1 == null || word2 == null) { return 0; } int m = word1.length(), n = word2.len...
2019-09-22 12:45:41
85
原创 583. Delete Operation for Two Strings (Medium) 最长公共子序列
公共子序列 public static int lengthOfLIS2(int[] nums1,int[] nums2) { int[][] dp=new int[nums1.length+1][nums2.length+1]; for(int i=1;i<=nums1.length;i++){ for(int j=1...
2019-09-22 12:08:46
120
原创 300. Longest Increasing Subsequence
class Solution { public int lengthOfLIS(int[] nums) { if(nums==null || nums.length<1) return 0; int[] dp=new int[nums.length]; Arrays.fill(dp,1); int...
2019-09-22 11:50:27
89
原创 377. Combination Sum IV (Medium)
class Solution { public int combinationSum4(int[] nums, int target) { int[] maximum = new int[target + 1]; maximum[0] = 1; Arrays.sort(nums); //求解顺序的完全背包问题时,对物品的...
2019-09-22 01:23:48
92
原创 139. Word Break
class Solution { public boolean wordBreak(String s, List<String> wordDict) { int n=s.length(); boolean[] dp=new boolean[n+1]; dp[0]=true; for(int i=1;i<...
2019-09-22 00:22:18
68
原创 518. Coin Change 2
class Solution { public int change(int amount, int[] coins) { int[] dp=new int[amount+1]; dp[0]=1; for(int i=0;i<coins.length;i++){ for(int j=coins[i];j&l...
2019-09-21 23:54:10
79
稀疏表示 OMP 代码可直接跑
2018-01-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人