394. Decode String

Problem description:

Given an encoded string, return its decoded string.

Readmore

695. Max Area of Island

Problem description:

Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.

Readmore

981. Time Based Key-Value Store

Problem description:

Create a timebased key-value store class TimeMap, that supports two operations.

Readmore

973. K Closest Points to Origin

Problem description:

Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0).

Readmore

note-System design

CAP:

  • Consistency: Assuming you have a storage system which has more than one machine, consistency implies that the data is same across the cluster, so you can read or write to/from any node and get the same data.

    Readmore

    355. Design Twitter

    Problem description:

    Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in the user’s news feed.

    Readmore

    note-Python

    List

    1. Create list

      1
      2
      3
      a = [0, 1, 2]
      a.append(3) # a = [0, 1, 2, 3]
      a += [4] # a = [0, 1, 2, 3, 4]

    Readmore

    145. Binary Tree Postorder Traversal

    Problem description:

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

    Readmore

    144. Binary Tree Preorder Traversal

    Problem description:

    Solution:

    time complexity: $O()$
    space complexity: $O()$
    reference:
    related problem:

    Readmore

    47. Permutations II

    Problem description:

    Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.

    Readmore