Lunski's Clutter

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

0%

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 »

經過這麼久的努力leetcode初級基礎題目我們已經走過一輪了,但我們一直沒進一步認識資料結構與演算法,我想在這暫停一下,先來理解基礎結構,之後的題目會比較好上手。

Read more »

最近上班聽日文歌發現有首不錯聽,小提琴聲讓人感受到油然而生的希望,Shvara吵著說要學,所以就來研究一下。

這首歌在說走到跟男朋友一起經過的大街,想到以前種種,景物依舊,人事已非,但還是因為不想忘記這段回憶而掙扎。[加油啊(吶喊

我想這種感覺就是物の哀れ吧。

Read more »

最近遇到對聊天有困擾的朋友,所以我買了這本書,並分享筆記給他,如果對他有幫助,也能幫到一樣有困擾的小夥伴們就太好了。

Read more »