Given an undirected graph, return true if and only if it is bipartite. Recall that a gra…
分类:LeetCode
LeetCode 54. Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For e…
三刷53. Maximum Subarray
Easy 没搞懂变量 不变量,这里preSum其实是定量,minPreSum是变量,所以我们要求变量的最小值,而不是去求不变量的最大值。 public int maxSubArray(int[] nums) { int …
[LeetCode] Inorder Successor in BST 二叉搜索树中的中序后继节点
Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note:…
[LeetCode] Partition to K Equal Sum Subsets 分割K个等和的子集
Given an array of integers nums and a positive integer k, find whether it’s possib…
[Leetcode] Compare Version Numbers 比较版本号
Compare Version Numbers Compare two version numbers version1 and version2. If version1 > version2 return 1,…
[CS101] Programming Languages and OOP 编程语言及面向对象基础题
编程语言及面向对象基础题 Design Pattern What is singleton? What’s its cons and pros? How to implement it?Definition:…
LeetCode | Flatten Binary Tree to Linked List(二叉树转化成链表)
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flatte…
78.Subsets
78.Subsets 题目: https://leetcode.com/problems/subsets/ 难度 : Medium Python代码 class Solution(object): def subsets…
3.无重复字符的最长子串(Swift版)
一、题目 给定一个字符串,找出不含有重复字符的最长子串的长度。 示例 1: 输入: “abcabcbb” 输出: 3 解释: 无重复字符的最长子串是 “abc”,其长度为 …
60 Permutation Sequence
60 Permutation Sequence 题目 The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labe…
240. Search a 2D Matrix II
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following prope…