- Todo
	- DONE 洗衣服
	- DONE 做数据库 lab
	  :LOGBOOK:
	  CLOCK: [2023-04-03 Mon 11:21:56]--[2023-04-03 Mon 12:18:36] => 00:56:40
	  CLOCK: [2023-04-03 Mon 12:48:48]--[2023-04-03 Mon 12:48:49] => 00:00:01
	  CLOCK: [2023-04-03 Mon 16:48:53]--[2023-04-03 Mon 17:48:37] => 00:59:44
	  :END:
	- DONE Figure out how to manage use flags for gentoo ( by using eix)
	  :LOGBOOK:
	  CLOCK: [2023-04-03 Mon 13:27:52]--[2023-04-03 Mon 13:27:54] => 00:00:02
	  :END:
	- LATER 复习概率论
	  collapsed:: true
		- LATER 公式法
		- LATER 求期望
		  :LOGBOOK:
		  CLOCK: [2023-04-03 Mon 14:25:17]
		  :END:
		- LATER 积分的公式
	- DONE [#A] 写学交论文
	  SCHEDULED: <2023-04-11 Tue .+1d>
	  DEADLINE: <2023-04-09 Sun>
	  :LOGBOOK:
	  CLOCK: [2023-04-04 Tue 13:56:38]--[2023-04-04 Tue 16:03:06] => 02:06:28
	  CLOCK: [2023-04-07 Fri 13:35:02]--[2023-04-07 Fri 13:46:01] => 00:10:59
	  
	  - State "DONE" from "NOW" [2023-04-07 Fri 13:46]
	  
	  * State "DONE" from "LATER" [2023-04-09 Sun 16:57]
	    CLOCK: [2023-04-09 Sun 16:57:28]--[2023-04-09 Sun 16:57:29] => 00:00:01
	    :END:
	  * DONE 内容
		- DONE 添加边缘计算对碳中和的影响
			- AI 对论文修改的建议： [[GPT notes]]
			  #+BEGIN_VERSE
			  To insert the new section on "Carbon Neutrality and Edge Computing" into the paper, you would need to determine the appropriate location based on the content of the section. Generally, this section could be inserted after the section on "The Benefits of Edge Computing," as it is related to the topic of sustainability and energy efficiency in edge computing.
			  
			  Here is an updated outline of the paper with the new section added:
			  
			  I. Introduction
			  A. Definition of Edge Computing
			  B. Importance of Edge Computing
			  C. Purpose of the Paper
			  
			  II. How Edge Computing Works
			  A. Basic Architecture of Edge Computing
			  B. Characteristics of Edge Computing
			  C. Comparison with Cloud Computing
			  
			  III. Applications of Edge Computing
			  A. IoT and Smart Devices
			  B. Autonomous Vehicles
			  C. Healthcare
			  D. Industry 4.0
			  E. Smart Grid
			  
			  IV. The Benefits of Edge Computing
			  A. Reduced Latency and Improved Response Time
			  B. Increased Security and Privacy
			  C. Reduced Bandwidth and Connectivity Costs
			  D. Improved Reliability and Availability
			  E. Enhanced User Experience
			  F. Carbon Neutrality and Energy Efficiency
			  
			  V. Carbon Neutrality and Edge Computing
			  A. Definition of Carbon Neutrality
			  B. Importance of Carbon Neutrality in Edge Computing
			  C. Techniques for Achieving Carbon Neutrality in Edge Computing
			  D. Impact of Carbon Neutrality on Business Operations
			  
			  VI. Challenges and Limitations of Edge Computing
			  A. Security Risks
			  B. Integration with Legacy Systems
			  C. Limited Computing Resources
			  D. Complexity of Deployment and Management
			  
			  VII. Future of Edge Computing
			  A. Trends and Innovations
			  B. Potential Applications
			  C. Impact on Society
			  
			  VIII. Conclusion
			  A. Summary of Key Points
			  B. Implications for Businesses and Society
			  C. Recommendations for Further Research.
			  #+END_VERSE
		- DONE 用 AI 修改摘要
		- DONE 加字数 300 字
		- DONE 加引用 2 个 \* LATER 格式：看 IEEE 的格式
	- DONE 概率论论文
	  DEADLINE: <2023-04-12 Wed>
	- DONE 参加商谈总决赛
	  SCHEDULED: <2023-04-08 Sat>
	- DONE 给杨哥机器学习的代码
	- DONE 护眼程序：提醒我休息眼睛 #projects
	- DONE edx 音乐课最终作业
	  DEADLINE: <2023-04-07 Fri>
-
- Daily reflection [[Daily reflections]]
	- What I've done
		- 看书
		- 学 leetcode
		- 做一堆 todo
	- What I've thought #thoughts
		- 看了不少书，这挺好，要坚持下去
		- DONE 写了很多 leetcode，但是很多问题都是直接背答案，不知道为什么要用那个方法，应该看下算法书。
	- Mood
		- good
-
- [[New computer 2023]]
	- Try the new pkgcore from gentoo
-
- Leetcode 3Sum
  id:: 642abd85-5c14-42c3-aa39-e7dc2773b2ec
	- Times:
		- Time when completed: 19:50
		- Time taken to complete: 47min
		- LATER Revisions: do it again in c++
		  SCHEDULED: <2023-05-19 Fri ++2w>
		  :LOGBOOK:
		  - State "DONE" from "LATER" [2023-04-21 Fri 16:05]
		  * State "DONE" from "LATER" [2023-05-23 Tue 20:26]
		  :END:
		  * [[Apr 21st, 2023]] 12mins java
	- Tags:
		- Algorithms: #two_pointers
		- Data structures: #array #set #interval
		- Difficulty: #difficulty_easy
		- Platforms: #leetcode
	- Links:
		- [link to the problem](https://leetcode.com/problems/3sum/description/)
	- Problem:
		- Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j] + nums[k] == 0`.
		- Notice that the solution set must not contain duplicate triplets.
	- Examples:
		- ```
		  Example 1:
		  
		  Input: nums = [-1,0,1,2,-1,-4]
		  Output: [[-1,-1,2],[-1,0,1]]
		  Explanation:
		  nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0.
		  nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0.
		  nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0.
		  The distinct triplets are [-1,0,1] and [-1,-1,2].
		  Notice that the order of the output and the order of the triplets does not matter.
		  
		  Example 2:
		  
		  Input: nums = [0,1,1]
		  Output: []
		  Explanation: The only possible triplet does not sum up to 0.
		  
		  Example 3:
		  
		  Input: nums = [0,0,0]
		  Output: [[0,0,0]]
		  Explanation: The only possible triplet sums up to 0.
		  
		  ```
	- Constraints:
		- `3 <= nums.length <= 3000`
		- `-105 <= nums[i] <= 105`
	- Thoughts:
		- #+BEGIN_VERSE
		  This is a O(n^2) two pointer problem.
		  First, we use a variable `i`, then between i + 1 and the end, we use two pointers to find the solution that adds up to 0, and store it in a set (it will not be duplicated)
		  The main difficulty here is to get to know java.
		  #+END_VERSE
	- Solution:
		- ```java
		  class Solution {
		      public List<List<Integer>> threeSum(int[] nums) {
		          // modified two pointer method
		          Arrays.sort(nums);
		          Set<List<Integer>> ans = new HashSet();
		          for (int i = 0; i < nums.length - 2; i++) {
		              int l = i + 1;
		              int r = nums.length - 1;
		              while (l < r) {
		                  int sum = nums[i] + nums[l] + nums[r];
		                  if (sum > 0) {
		                      r--;
		                  } else if (sum < 0) {
		                      l++;
		                  } else {
		                      ans.add(Arrays.asList(nums[l], nums[r], nums[i])); //java's set will check for dupes by default.
		                      l++;
		                      r--;
		                  }
		              }
		          }
		          return new ArrayList<List<Integer>>(ans);
		      }
		  }
		  ```
-
- Leetcode Container With Most Water
  id:: 642ac7bd-a908-4155-b839-f58ca64f4672
	- Times:
		- Time when completed: 20:34
		- Time taken to complete: 30min
		- LATER Revisions:
		  SCHEDULED: <2023-05-19 Fri ++2w>
		  :LOGBOOK:
		  - State "DONE" from "LATER" [2023-04-21 Fri 15:23]
		  :END:
		  * [[Apr 21st, 2023]] 10min
	- Tags:
		- Algorithms: #greedy #two_pointers
		- Data structures: #array #interval
		- Difficulty: #difficulty_easy
		- Platforms: #leetcode
	- Links:
		- [link to the problem](https://leetcode.com/problems/container-with-most-water/description/)
	- Problem:
		- You are given an integer array `height` of length `n`. There are `n` vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` and `(i, height[i])`.
		- Find two lines that together with the x-axis form a container, such that the container contains the most water.
		- Return _the maximum amount of water a container can store_.
		- **Notice** that you may not slant the container.
	- Examples:
		- ![](https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg)
		- ```
		  Example 1:
		  
		  Input: height = [1,8,6,2,5,4,8,3,7]
		  Output: 49
		  Explanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.
		  
		  Example 2:
		  
		  Input: height = [1,1]
		  Output: 1
		  ```
	- Constraints:
		- `n == height.length`
		- `2 <= n <= 10^5`
		- `0 <= height[i] <= 104`
	- Thoughts:
		- There are 10^5 numbers in the array, so the O(N^2) brute force is not an option.
		- By analyzing this problem, we can use greedy algorithm, because the only way we can get a better result is by move the shortest line in two sides in a longer one, and we simply keep track of this interval using two pointers method.
		- 1. For the first iteration of our answer, we can keep track of the two sides using two pointers `l` and `r`, and in a loop we decide which one to increment / reduce by calculating which one's height is bigger, and we move the side which has a smaller height.
		- 2. To optimize the answer we can think about the algorithm in step one: _When we are moving one side, the result might be **even smaller** if t**he new height is smaller** than the original one_. To address this issue, we can add a while loop and a marker variable `smol` to keep track of the smaller side.
	- Solution:
		- ```java
		  class Solution {
		    public int maxArea(int[] height) {
		      // Use greedy algorithm with two pointers
		      int l = 0, r = height.length - 1;
		      int max = 0;
		      while (l < r) {
		        max = Math.max(max, (r - l) * Math.min(height[l], height[r]));
		        // the sum will only be bigger if the next line is higher.
		        int smol = Math.min(height[l], height[r]);
		        // only one of the loop will run
		        while (height[l] <= smol && l < r) {
		          l++;
		        }
		        while (height[r] <= smol && l < r) {
		          r--;
		        }
		      }
		      return max;
		    }
		  }
		  ```