Lunski's Clutter

This is a place to put my clutters, no matter you like it or not, welcome here.

0%

從摸索跟不斷追尋下,我理解到課表需要修正,由於週三一直都是去復健,而去健身房時間大約只能做
3個動作,我規劃了一天上肢/下肢各兩個動作,搭配一個胸腹,這份課表目的是變成上下分化訓練,在某部分痠痛時訓練另一半。

Read more »

Given the root of a binary tree, return the inorder traversal of its nodes’ values.

Example 1:

1
2
Input: root = [1,null,2,3]
Output: [1,3,2]

Example 2:

1
2
Input: root = []
Output: []

Example 3:

1
2
Input: root = [1]
Output: [1]

Example 4:

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

Example 5:

1
2
Input: root = [1,null,2]
Output: [1,2]
Read more »

在吃飯聽到這首歌,很喜歡主唱細膩的聲線,MV在說男女遇到災難時的反應,但我想是在說更普羅大眾的-當感情遇到考驗時你還會選擇繼續相信對方嗎?

Read more »

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

push(x) – Push element x onto stack.
pop() – Removes the element on top of the stack.
top() – Get the top element.
getMin() – Retrieve the minimum element in the stack.

Example 1:

1
2
3
4
5
6
Input
["MinStack","push","push","push","getMin","pop","top","getMin"]
[[],[-2],[0],[-3],[],[],[],[]]

Output
[null,null,null,null,-3,null,0,-2]

Explanation

1
2
3
4
5
6
7
8
MinStack minStack = new MinStack();
minStack.push(-2);
minStack.push(0);
minStack.push(-3);
minStack.getMin(); // return -3
minStack.pop();
minStack.top(); // return 0
minStack.getMin(); // return -2
Read more »

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.

You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.

Example 1:

1
2
Input: 1->2->3->4->5->NULL
Output: 1->3->5->2->4->NULL

Example 2:

1
2
Input: 2->1->3->5->6->4->7->NULL
Output: 2->3->6->7->1->5->4->NULL
Read more »