- 博客(8)
- 收藏
- 关注
原创 LeetCode-347 出现频率最多的 k 个数
leetcode-347. Top K Frequent Elements本文答案参考自leetcode评论区解法一:桶排序时间复杂度O(n)class Solution { public List<Integer> topKFrequent(int[] nums, int k) { Map<Integer,Integer> map = ...
2019-08-08 15:39:07
324
原创 leetcode 四道shell编程题目
leetcode-192 统计词频cat words.txt | tr -s ' ' '\n' | sort | uniq -c | sort -r | awk '{ print $2, $1 }'tr -s ' ' '\n' 将空格替换成回车,每个单词一行sort 按字典序排序,保证重复的行相邻uniq -c 去掉重复的行,-c...
2019-08-07 21:59:41
299
原创 Leetcode之PathSum问题
Path Sumleetcode - 112. Path Sumclass Solution { public boolean hasPathSum(TreeNode root, int sum) { if(root==null){ return false; } if(root.left==...
2019-08-01 18:24:25
263
原创 LCA-二叉树公共祖先问题
二叉搜索树leetcode 235. Lowest Common Ancestor of a Binary Search Treeclass Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if(root.val>p.val &am...
2019-07-30 16:56:57
192
原创 牛客网中级项目第三课mysql连不上的问题com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not
我电脑上安装的mysql版本是8.0.17在跑测试用例时,一直报错,提示连不上数据库:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to…网上查了好久都说是因为代码中数据库驱动的版本和数据库版本不对应!又按照网上的方法都试了一遍,还是不行。最后把...
2019-07-29 23:52:33
313
原创 SQL LEFT JOIN
SQL-LEFT JOINLEFT JOIN 关键字从左表(table1)返回所有的行,即使右表(table2)中没有匹配。如果右表中没有匹配,则结果为 NULL。SELECT column_name(s)FROM table1LEFT JOIN table2ON table1.column_name=table2.column_name;实例select emp_no fro...
2019-07-16 23:50:12
320
原创 SQL_having
SQL HAVINGHAVING 子句在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与聚合函数一起使用。HAVING 子句可以让我们筛选分组(GROUP BY)后的各组数据。实例select emp_no,count(salary) as t from salariesgroup by emp_nohaving t>15...
2019-07-16 19:35:43
282
原创 链表反转总结
链表反转单链表反转leetcode 206 reverse-linked-list递归解法class Solution { public ListNode reverseList(ListNode head) { if(head==null || head.next==null){ return head; } ...
2019-07-03 00:03:54
352
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人