Ruizhi Ma's Blog

Keep Calm and Carry On

Problem 71

Solution URL https://leetcode.com/submissions/detail/412039107/ 代码 class Solution { public String simplifyPath(String path) { //Time: O(n) //Space: O(n) String tokens...

Problem 394

Solution URL https://leetcode.com/submissions/detail/412071922/ 代码 class Solution { public String decodeString(String s) { //ans: https://leetcode-cn.com/problems/decode-string/solut...

Problem 232

Solution URL https://leetcode.com/submissions/detail/411969247/ 代码 class MyQueue { //https://leetcode-cn.com/problems/implement-queue-using-stacks/solution/yong-zhan-shi-xian-dui-lie-by-leet...

Problem 225

Solution URL https://leetcode.com/submissions/detail/411981168/ 代码 class MyStack { //ans: https://leetcode-cn.com/problems/implement-stack-using-queues/solution/yong-dui-lie-shi-xian-zhan-by...

Problem 150

Solution URL https://leetcode.com/submissions/detail/412013996/ 代码 class Solution { public int evalRPN(String[] tokens) { //Time: O(n) //Space: O(n) Stack<Integer&...

Problem 155

Solution URL https://leetcode.com/submissions/detail/411645232/ 代码 class MinStack { //ref: https://leetcode-cn.com/problems/min-stack/solution/zui-xiao-zhan-by-leetcode-solution/ //Time:...

Problem 130

Solution URL https://leetcode.com/submissions/detail/411553487/ 代码 class Solution { //BFS //定义方向 public static final List<int[]> DIRECTIONS = Arrays.asList( new int[]{1...

Problem 27

Remove Element

问题描述 https://leetcode.com/problems/remove-element/ 解决思路(2019-12-23) use two pointer, the first pointer marks the element which is different from the val, the second pointer traverses the whole ...

Problem 26

Remove Duplicates from Sorted Array

问题描述 https://leetcode.com/problems/remove-duplicates-from-sorted-array/ 解决思路(2019-12-23) use two pointer. the first pointer marks the postion not repeated, and the second pointer marks the trav...

Problem 24

Swap Nodes In Pairs

问题描述 https://leetcode.com/problems/swap-nodes-in-pairs/ 解决思路(2019-12-22) while curr.next.next != null && curr.next != null, swap the two node the specific steps of swap coded in the f...