摘要:
There are N courses, labelled from 1 to N. We are given relations[i] = [X, Y], representing a prerequisite relationship between course X and course Y: 阅读全文
摘要:
Given a non-decreasing array of positive integers nums and an integer K, find out if this array can be divided into one or more disjoint increasing su 阅读全文
摘要:
Typically, an implementation of in-order traversal of a binary tree has O(h) space complexity, where h is the height of the tree. Write a program to c 阅读全文
摘要:
Given a sorted array of non-negative integers, find the smallest positive integer that is not the sum of a subset of the array. For example, for the i 阅读全文
摘要:
LeetCode 424. Longest Repeating Character Replacement Given a string that consists of only uppercase English letters, you can replace any letter in th 阅读全文
摘要:
Given a set of closed intervals, find the smallest set of numbers that covers all the intervals. If there are multiple smallest sets, return any of th 阅读全文
摘要:
Given a string which we can delete at most k, return whether you can make a palindrome. For example, given 'waterrfetawx' and a k of 2, you could dele 阅读全文
摘要:
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. 阅读全文