摘要:
Graph: n nodes, m edges Representation Adjacency Matrix: O(n^2) space, not efficient for sparse graph Adjacency List: O(n + m) space, efficient for sp 阅读全文
摘要:
There are N piles of stones arranged in a row. The i-th pile has stones[i] stones. A move consists of merging exactly K consecutive piles into one pil 阅读全文
摘要:
Given an array A of 0s and 1s, we may change up to K values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s. 阅读全文
摘要:
We are given that the string "abc" is valid. From any valid string V, we may split V into two pieces X and Y such that X + Y (X concatenated with Y) i 阅读全文
摘要:
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Example 2: 阅读全文
摘要:
Given an array of integers A, find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be large, return the 阅读全文
摘要:
On a N x N grid of cells, each cell (x, y) with 0 <= x < N and 0 <= y < N has a lamp. Initially, some number of lamps are on. lamps[i] tells us the lo 阅读全文
摘要:
In an array A containing only 0s and 1s, a K-bit flip consists of choosing a (contiguous) subarray of length K and simultaneously changing every 0 in 阅读全文
摘要:
Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
摘要:
This problem was asked by Google. In a directed graph, each node is assigned an uppercase letter. We define a path's value as the number of most frequ 阅读全文