Given an undirected graph, return true if and only if it is bipartite. Recall that a gr...
Given an undirected graph, return true if and only if it is bipartite. Recall that a gr...
DFS, BFS 假设点的数目为v, time complexity都为O(v)space complexity, BFS worst case为O(v), 但是DFS为O(...
Given a 01 matrix M, find the longest line of consecutive one in the matrix. The line c...
Given two sentences words1, words2 (each represented as an array of strings), and a lis...
On the first row, we write a 0. Now in every subsequent row, we look at the previous ro...
You are playing a simplified Pacman game. You start at the point (0, 0), and your desti...
In a directed graph, we start at some node and every turn, walk along a directed edge o...
In a given array nums of positive integers, find three non-overlapping subarrays with m...
There is a box protected by a password. The password is n digits, where each letter can...
A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y...
Minimize Max Distance to Gas Station On a horizontal number line, we have gas stations ...
Given an array of scores that are non-negative integers. Player 1 picks one of the numb...
Given an array of integers with possible duplicates, randomly output the index of a giv...
题目大意:给一个排列,可能有重复元素,我们将数组拆分成一些“块”(分区),并对每个块进行单独排序。连接它们之后,结果等于排序后的数组。问最多能够分成多少个分区(块)分析:因为...
Given an array consisting of n integers, find the contiguous subarray whose length is g...
Given a chemical formula (given as a string), return the count of each atom. An atomic ...
Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a s...
By now, you are given a secret signature consisting of character 'D' and 'I'. 'D' repre...
You have 4 cards each containing a number from 1 to 9. You need to judge whether they c...
Given two non-negative integers num1 and num2 represented as string, return the sum of ...