Lynn Study Notes

.NET Developer, Open Source Enthusiast

LeetCode 136. Single Number (Easy)

Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.

You must implement a solution with a linear runtime complexity and use only constant extra space.

Example:

Input: nums = [2,2,1]
Output: 1

Input: [4,1,2,1,2]
Output: 4

LeetCode 70. Climbing Stairs (Easy)

You are climbing a staircase. It takes n steps to reach the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Example :

Input: n = 2
Output: 2
Explanation: There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps

Input: n = 3
Output: 3
Explanation: There are three ways to climb to the top.
1. 1 step + 1 step + 1 step
2. 1 step + 2 steps
3. 2 steps + 1 step

LeetCode 20. Valid Parentheses (Easy)

Given a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.

An input string is valid if:

Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order.


LeetCode 1. Two Sum (Easy)

https://leetcode.com/problems/two-sum/ 題目的要求是給予一個int陣列和目標值,回傳目標值是陣列中哪兩個索引中加起來的。 Example : Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. 想了想可以直接

C#檔案壓縮搬移處理

雖然這個Blog是藉由GitHub Pages代管,不過像是md檔和其他資料不是說要復原就復原的,要復原還要經過一段步驟,早上實作了一次實在是搞得頭很昏,找時間在照著教學做一次並把過程記錄下來以備不時之需。

養成備份習慣是很重要的,不然資料不見了去資料救援還不一定能把資料救回來,所以我要讓我這Blog的檔案做個每日備份到雲端裡面。

首先看了一下這資料夾的檔案非常瑣碎,才93M的空間卻有14392個檔案,這樣直接備份到雲端光同步就會耗掉相當大的資源,所以我的想法是把資料夾壓縮起來再備份到雲端就好了。