image

因為這系列做起來很快,所以就索性一次貼在一篇文了!

PART 1-344. Reverse String (Easy)

不需要回傳一個 list,只需更改 s 即可!

同時,題目要求:in-place 的去做 swap

Example 1:

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

今天要來解的題目是 Leetcode-7. Reverse Integer,難度為 Easy,

而我所使用的語言是 python3

(一個 yahoo 工程師表示,他只刷了 50 題 easy 就有工作了,不要小看 easy 題

壹、理解題目

Given a signed 32-bit integerx, returnxwith its digits reversed. If reversingxcauses the value to go outside the signed 32-bit integer range[-231, 231- 1], then return0.

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

今天要來解的題目是 Leetcode-152. Maximum Product Subarray,難度為 Medium,

而我所使用的語言是 python3

壹、理解題目

Given an integer arraynums, find a contiguous non-empty subarray within the array that has the largest product, and returnthe product.

Note: A subarray is a contiguous subsequence of the array.

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

Kadane's Algorithm for solving Maximum Subarray

如果你已經知道某 array A 從 「頭」 加到「第 i 個數字」的最大值,

那該 array 從 「頭」 加到「第 ( i +1 ) 個數字」的最大值呢?

只會有兩種選擇喔!

  1. A[i+1] - 直接捨棄掉前面的最大值(ex: A[i+1] > 0,但前面得到的最大值是負的,這樣相加反而會 < A[i+1])

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

黑人問號圖的主角到底是誰?其實他的背景可大有來頭! | 網路人氣話題| DailyView 網路溫度計

今天要來解的題目是 Leetcode-238. Product of Array Except Self,難度為 Medium,

而我所使用的語言是 python3

壹、理解題目

Given an integer arraynums, returnan arrayanswersuch thatanswer[i]is equal to the product of all the elements ofnumsexceptnums[i].

Example 1:

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

今天來做一點有趣的實作吧!

首先,找一個你有興趣小小改造的網頁(?

本篇文會以 總統簡介 為例喔!

接著,在螢幕任意畫面按右鍵,並選擇「檢查」(或按快捷鍵 Ctrl+Shift+I)

其實,看不懂 html 也沒關係啦,

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()


Queen's Gambit 已經紅了一陣子了,

或許你還在觀望,「關於西洋棋的影集?」聽起來不是特別有趣,

但開始看第一集吧,你會停不下來的 

I. Beth & 西洋棋

"Chess isn't always competitive. Chess can also be beautiful. It was the board I noticed first. It's an entire world of just 64 squares. I feel safe in it. I can control it. I can dominate it. And it's predictable, so if I get hurt, I only have myself to blame." - Beth Harmon

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

今天要來解的題目是 Leetcode-42. Trapping Rain Water,難度為 Hard,

而我所使用的語言是 python3

壹、理解題目

Givennnon-negative integers representing an elevation map where the width of each bar is1, compute how much water it can trap after raining.

Input: height = [0,1,0,2,1,0,1,3,2,1,2,1]

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

今天要來解的題目是 Leetcode-142.Linked List Cycle II ,難度為中等,


而我所使用的語言是 python3


壹、理解題目


Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.


There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally,pos is used to denote the index of the node that tail's next pointer is connected to. Note that pos is not passed as a parameter.

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

image

今天要來解的題目是 Leetcode-141. Linked List Cycle,難度為易,

而我所使用的語言是 python3

壹、理解題目

Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.

There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally,pos is used to denote the index of the node that tail's next pointer is connected to. Note that pos is not passed as a parameter.

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()


數學女孩有許多系列,

如果對這本書有興趣,或是想開始嘗試閱讀科普書籍,

《數學女孩:費馬最後定理》這本書推薦給你喔 

大意

作者透過國、高中學生主角的一問一答、互相討論切磋一步步推導至定理,因各角色性格和對數學的切入角度不同,呈現出多樣化的解題方法,產生令人驚豔的火花。

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

undefined

乍看書面標題-《爺爺的證明題:上帝存在嗎?》可能不會發現這是一本數學/科普的書籍。

數學?多數人看到這類書籍可能就想逃,

但我第一次閱讀是在升高一的暑假,非常平易近人,

有些比較艱深的觀念確實比較難些,但讀起來是很吸引人的!

我並不是基督徒,然而一本數學與宗教的書,看起來挺有意思的,讀著讀著,就沉浸這本數學小說中了。

Sofie 舒霏 發表在 痞客邦 留言(0) 人氣()

1 2 3
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。