Categories
LeetCode

LeetCode 136. Single Number

Source: https://leetcode.com/problems/single-number/

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

Categories
LeetCode

LeetCode 49. Group Anagrams

Given an array of strings, group anagrams together.

Categories
LeetCode

LeetCode 36. Valid Sudoku

Source: https://leetcode.com/problems/valid-sudoku/

Determine if a 9×9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

  1. Each row must contain the digits 1-9 without repetition.
  2. Each column must contain the digits 1-9 without repetition.
  3. Each of the 9 3x3 sub-boxes of the grid must contain the digits 1-9 without repetition.
Categories
LeetCode

LeetCode Hashmap, HashSet Problems and Solutions

Sometimes we need a data structure, it can save and retrieve data rapidly. In lots of circumstances, a hashtable is our best choice. Hashtable is a complex dynamic data structure, in the best situation is saving and retrieving time complexity is O(1).

In this article, we don’t discuss the implementation of the hashtable, We only collect the problems of the hashtable.

Some problems suit for the hashtable, like problems related string, may also suit for array solution. We may choose an array to solve these problems, but we can also use hashtable either.

Problems and Solutions:

Categories
Finance

Bridgewater’s Ray Dalio Discusses the Impact of China’s Growth on the World Economy

8/6/2019,Bridgewater’s Ray Dalio post a new video on Youtube, talk about the impact of China’s Growth on the World Economy with his college.

Categories
Apple

Mac OS Catalina Beta bug

I have two Mac often use. Mac OS Catalina is working fine at my Macbook pro. But these two days, my Mac pro got a lot of problems.

Categories
LeetCode

LeetCode 844. Backspace String Compare (Java)

Source: https://leetcode.com/problems/backspace-string-compare/

Given two strings S and T, return if they are equal when both are typed into empty text editors. #means a backspace character.

Categories
LeetCode

LeetCode 341. Flatten Nested List Iterator (Java)

Source: https://leetcode.com/problems/flatten-nested-list-iterator/

Given a nested list of integers, implement an iterator to flatten it.

Each element is either an integer, or a list — whose elements may also be integers or other lists.

Categories
LeetCode

LeetCode 232. Implement Queue using Stacks (Java)

Source: https://leetcode.com/problems/implement-queue-using-stacks/

Implement the following operations of a queue using stacks.

  • push(x) — Push element x to the back of queue.
  • pop() — Removes the element from in front of queue.
  • peek() — Get the front element.
  • empty() — Return whether the queue is empty.
Categories
LeetCode

LeetCode 225. Implement Stack using Queues (Java)

Source: https://leetcode.com/problems/implement-stack-using-queues/

Implement the following operations of a stack using queues.

  • push(x) — Push element x onto stack.
  • pop() — Removes the element on top of the stack.
  • top() — Get the top element.
  • empty() — Return whether the stack is empty.