- 博客(65)
- 资源 (6)
- 收藏
- 关注
转载 AutocompleteSystem
Note:MANY DETAILS ARE MISSED:If less than 3, return as many as it. So it could be NPE when queue.poll().getKey()Use alphabetical order if times are same. So in the queu need to compare value first then compare string.Logically it needs to set chi
2021-08-11 23:21:37 98
原创 2021-06-20微软面试
package msinterview;public class CoinTransition {static int count = 0;public static void main(String[] args) {int[] coins = new int[] {1, 1, -1}; System.out.print(maxTransition(coins));}// 1是正面 -1是花static int maxTransition(int[] coins) { for (i
2021-06-20 12:36:02 143
原创 【刷题】leetcode 355. Design Twitter
public class Twitter { Map<Integer, Set<Integer>> fans = new HashMap<>(); Map<Integer, LinkedList<Tweet>> tweets = new HashMap<>(); int cnt = 0; public void postTweet(int userId, int tweetId) { i
2020-10-08 20:43:42 207
原创 【刷题】leetcode 113 path sum II
Example:Given the below binary tree and sum = 22, 5 / \4 8/ / 11 13 4/ \ / 7 2 5 1Return:[[5,4,11,2],[5,8,4,5]]/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; *
2020-10-08 15:12:53 96
原创 【刷题】leetcode 621 task schedule
Given a characters array tasks, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could complete either one task
2020-10-08 15:07:51 87
原创 【刷题】leetcode 763 partition labels
A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing the size of these parts.Example 1:Input: S = “ab
2020-10-08 15:02:44 111
原创 【刷题】Leetcode 394 decode string
用栈public class Solution { public String decodeString(String s) { String res = ""; Stack<Integer> countStack = new Stack<>(); Stack<String> resStack = new Stack<>(); int idx = 0; while (id
2020-10-08 14:59:04 80
原创 minimum depth tree
class Solution {// 从叶子节点往上遍历,最终剩下的是结果public List findMinHeightTrees(int n, int[][] edges) {List res = new ArrayList<>();if (n == 1) {res.add(0);return res;}int[] degree = new int[n];Map<Integer, Set> map = new HashMap<>();for (i
2020-09-20 20:42:50 66
原创 [刷题]连续整数
15=1+2+3+4+515=4+5+615=7+81.如果输入n是奇数,那连续整数可以表示为:n = (n-1)/2 + (n+1)/22.如果输入n是偶数,分两种情况:情况1:n一直除以2,如果最终结果是奇数(最终不是1),那n可以是连续奇数组成情况2:n一直除以2,结果一直是偶数,那无法形成连续的奇数,即该数是2的n次方...
2020-08-03 15:18:51 353
原创 刷题:(0,0)到(i,j)最大值
题目:2 31 2 31 0 2最大值:8DP算法public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int row = sc.nextInt(); int column = sc.nextInt(); int[][] dpMat = new int[row][column]
2020-07-31 18:00:57 222
原创 【刷题】Leetcode 171. Excel Sheet Column Number
有一段时间没有刷题了,因为我已经拿到**菊厂**的offer啦! 回头看写的这些博客,都是对做过的的题的总结,代码规范,时间复杂度,注释等写的还可以更好一些。 我知道自己的总结和格式都*不够*到位和漂亮,没有特别认真的去书写,都是做完题草草的留下来了而已。 所以,今后还是会更多的总结,包括这一年左右国内大厂的面经,分享给可能和我一样拧巴一样努力奋进想要铁杵成针的童鞋。 今天写这道题,是因为这是道面试原题哦!A -> 1B -> 2C -> 3…Z...
2020-05-26 15:51:57 116
原创 【刷题】Leetcode 146. LRU Cache
class LRUCache { HashMap<Integer, Node> map; int capacity; int count; Node head; Node tail; public LRUCache(int capacity) { map = new HashMap<Integer, Node>...
2020-04-11 21:04:37 140
原创 【刷题】Leetcode 300. Longest Increasing Subsequence
3 10 1 8 5 6 9 4 dp[]: 1 2 1 2 2 3 4 2public class Solution { public int lengthOfLIS(int[] nums) { if (nums.length == 0) { return 0; } int[] dp =...
2020-03-24 19:55:54 86
原创 虚拟化和云计算
!](https://img-blog.csdnimg.cn/20200310174208355.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzE5NDUwOTIx,size_16,color_FFFFFF,t_70)
2020-03-10 17:43:22 117
原创 英语(from little sheldon)
beside herself 气疯了,着急be a good sport 有风度you have the floor 你可以说了bluff 唬人on the heels of 紧接着
2020-02-29 18:57:04 245
转载 spring容器实现
Spring容器的简单实现(IOC原理)引言:容器是什么?什么是容器?Spring容器又是啥东西?我给Spring容器一个对象名字,为啥能给我创建一个对象呢?一、容器是装东西的,就像你家的水缸,你吃饭的碗等等。 java中能作为容器的有很多,例如Map,List,数组.....还有好多二、Spring 容器的核心就是一个Map集合(可能不是很准确,见谅!)Map<String,...
2020-02-28 17:23:12 117
原创 你问我都学了啥
jvm: https://www.bilibili.com/video/av70166821/?spm_id_from=333.788.videocard.1mysql高级: https://www.bilibili.com/video/av68633494/?p=44&t=31spring: https://www.bilibili.com/video/av71252572?p=2...
2020-02-28 13:56:23 96
原创 计算机网络
广域网: https://www.bilibili.com/video/av40760446?from=search&seid=15674602669622404275socket编程:https://www.bilibili.com/video/av69214367?p=8局域网:https://www.bilibili.com/video/av9876107?p=2香农公式:ht...
2020-02-22 17:53:41 76
原创 计算机原理???
制作8位计算机:https://www.bilibili.com/video/av77065201?p=62计算机如何读取代码:https://www.bilibili.com/video/av62271485How a CPU works: https://www.bilibili.com/video/av9667986?from=search&seid=1517593687...
2020-02-22 17:50:23 119
原创 93. Restore IP Addresses
Example:Input: “25525511135”Output: [“255.255.11.135”, “255.255.111.35”]class Solution { public List<String> restoreIpAddresses(String s) { List<String> list = new ArrayList();...
2019-12-25 15:23:17 66
原创 19. Remove Nth Node From End of List
/**Definition for singly-linked list.public class ListNode {int val;ListNode next;ListNode(int x) { val = x; }}*/class Solution {public ListNode removeNthFromEnd(ListNode head,...
2019-12-25 15:22:33 60
原创 牛客网 华为编程
Leetcode 37class Solution { public void solveSudoku(char[][] board) { if(board.length == 0 || board == null) return; helper(board, 0); } public boolean helper(...
2019-12-22 11:57:30 98
原创 【刷题】Leetcode 347. Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1]class Solution { ...
2019-12-18 19:16:49 116
原创 【刷题】Leetcode 746. Min Cost Climbing Stairs
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of t...
2019-12-09 15:55:11 74
原创 【刷题】Leetcode 494. Target Sum
Example 1:Input: nums is [1, 1, 1, 1, 1], S is 3.Output: 5Explanation:-1+1+1+1+1 = 3+1-1+1+1+1 = 3+1+1-1+1+1 = 3+1+1+1-1+1 = 3+1+1+1+1-1 = 3There are 5 ways to assign symbols to make the sum ...
2019-12-08 18:51:08 63
原创 【刷题】Leetcode 459. Repeated Substring Pattern
Example 1:Input: “abab”Output: TrueExplanation: It’s the substring “ab” twice.Example 2:Input: “aba”Output: False暴力法:public boolean repeatedSubstringPattern(String str) { int l = str.length()...
2019-12-06 16:04:18 153
原创 【刷题】Leetcode 862. Shortest Subarray with Sum at Least K
暴力解class Solution { public int shortestSubarray(int[] A, int K) { int[] P = new int[A.length + 1]; for(int i = 0; i < A.length; i++){ P[i + 1] = P[i] + A[i]; ...
2019-12-05 19:53:04 74
原创 【刷题】Leetcode 212. Word Search II
Example:Input:board = [[‘o’,‘a’,‘a’,‘n’],[‘e’,‘t’,‘a’,‘e’],[‘i’,‘h’,‘k’,‘r’],[‘i’,‘f’,‘l’,‘v’]]words = [“oath”,“pea”,“eat”,“rain”]Output: [“eat”,“oath”]避免有相同前缀的词重复查找比如“aaaaaax”, “aaaaaay” 所以...
2019-11-25 23:24:25 109
原创 【刷题】Leetcode 208. Implement Trie (Prefix Tree)
class TreeNode { char val; TreeNode[] next; boolean isEnd; public TreeNode(){ this.next = new TreeNode[26]; }}class Trie { public TreeNode root; /** Initialize ...
2019-11-25 19:23:22 96
原创 【刷题】Leetcode 341. Flatten Nested List Iterator
Example 1:Input: [[1,1],2,[1,1]]Output: [1,1,2,1,1]Explanation: By calling next repeatedly until hasNext returns false,the order of elements returned by next should be: [1,1,2,1,1].Example 2:Inp...
2019-11-25 09:50:15 172
原创 【刷题】Leetcode 236. Lowest Common Ancestor of a Binary Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { Tr...
2019-11-24 23:06:40 94
原创 【刷题】Leetcode 10. Regular Expression Matching
‘.’ Matches any single character.‘*’ Matches zero or more of the preceding element.Example 1:Input:s = “aa”p = “a”Output: falseExplanation: “a” does not match the entire string “aa”.Example 2:...
2019-11-24 22:00:57 70
原创 【刷题】Leetcode 207. Course Schedule
There are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair:...
2019-11-20 16:15:45 77
原创 【刷题】Leetcode 91. Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ -> 1‘B’ -> 2…‘Z’ -> 26Given a non-empty string containing only digits, determine the tot...
2019-11-19 14:15:08 95
原创 【刷题】Leetcode 148. Sort List
Example 1:Input: 4->2->1->3Output: 1->2->3->4/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { va...
2019-11-19 12:55:05 70
52001CC1C8 Java 实践17-18-3.zip
2020-03-06
zuoyexitong .zip
2020-03-06
基于matlab的车牌识别
2016-02-17
基于android的二维码识别系统研究与实现
2016-02-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人