posted @ 2022-03-08 05:17
阳光明媚的菲越
阅读(0)
推荐(0)
摘要:
This is a easier common grap and look for shortest path problem, time complexity: O(m*n): class Solution { public int getFood(char[][] grid) { int m =
阅读全文
posted @ 2022-03-05 15:02
阳光明媚的菲越
阅读(29)
推荐(0)
摘要:
This is graph and look for the shortest path, so BFS should be solution. But how to handle K? We can look K as a parameter of every node. My first sol
阅读全文
posted @ 2022-03-05 14:29
阳光明媚的菲越
阅读(49)
推荐(0)
摘要:
This is a graph problem, and the problem try to find the shortest path. So BFS is just right solution, the following is my first solution. It works bu
阅读全文
posted @ 2022-03-05 09:03
阳光明媚的菲越
阅读(50)
推荐(0)
posted @ 2022-02-25 12:11
阳光明媚的菲越
阅读(0)
推荐(0)
摘要:
The key point of this problem is to find "key" of every words. Time complexity: O(n) How to find key of every string, we make every key as a string wi
阅读全文
posted @ 2022-02-25 11:15
阳光明媚的菲越
阅读(21)
推荐(0)
摘要:
This problem requires add continues numbers, so the best solution is using prefix sum. Time complexity: O(n). class Solution { public boolean checkSub
阅读全文
posted @ 2022-02-25 10:42
阳光明媚的菲越
阅读(25)
推荐(0)
摘要:
This is a similar problem with 398. Random Pick Index The following is my solution, which is easy to undersand: class Solution { int count = 0; Random
阅读全文
posted @ 2022-02-25 08:35
阳光明媚的菲越
阅读(31)
推荐(0)
摘要:
This is a similar problem with: 382. Linked List Random Node The following is my solution, which is easy to understand: class Solution { Map<Integer,L
阅读全文
posted @ 2022-02-25 08:19
阳光明媚的菲越
阅读(25)
推荐(0)
摘要:
Because the character can be duplicated, so we cannot use HashSet. This is easy if using bucket: public char findTheDifference(String s, String t) { i
阅读全文
posted @ 2022-02-25 06:26
阳光明媚的菲越
阅读(22)
推荐(0)