题目 Reverse a singly linked list. 解题思路 头插法 代码 /** * Definition for singly-linked list. * type ListNode struct {…
分类:LeetCode
[LeetCode] Course Schedule II 课程清单之二,Course Schedule 课程清单
There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequ…
[LeetCode] Jewels and Stones 珠宝和石头
You’re given strings J representing the types of stones that are jewels, and S&nbs…
[CS101] Operating System and Low Level Fundamental 操作系统及底层基础面试题
操作系统 进程与线程 What’s the difference between thread and process?A process is an instance of a computer progr…
binary-tree-level-order-traversal-ii
描述: Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left…
三刷366. Find Leaves of Binary Tree
LinkedIn tag Medium 这道题三刷了都还没自主做出来。问题在于不知道这个题跟节点高度的联系。 我们定义helper function为find the height of the root node. 这…
474. 一和零
使用滚动数组法来优化空间复杂度 class Solution(object): def findMaxForm(self, strs, m, n): """ :type strs: List[str] :type m: …
[LeetCode] Random Point in Non-overlapping Rectangles 非重叠矩形中的随机点
Given a list of non-overlapping axis-aligned rectangles rects, write a function pic…
LeetCode | Palindrome Partitioning(将一个子串划分成回文子串)
Given a string s, partition s such that every substring of the partition is a palindrome. Retur…
[LeetCode]Longest Continuous Increasing Subsequence 最长连续增长序列
链接:https://leetcode.com/problems/longest-continuous-increasing-subsequence/description/ 难度:Easy 题目:674. Longes…
2018-09-12 888. Fair Candy Swap
题意:给你两个数组,从两个数组中各选一个数交换位置,新得到的两个数组的元素总和相等。 思路一:先得到两个数组各自的元素总和,进而得到平均值,再遍历元素少的vector,得到每个元素如果交换的话需要从另一个vector中得…
[LeetCode By Go 95]232. Implement Queue using Stacks
题目 Implement the following operations of a queue using stacks. push(x) — Push element x to the back of q…