Given a linked list and a value x, partition it such that all nodes less than x come bef…
分类:LeetCode
[LeetCode] Add Digits 加数字
Given a non-negative integer num, repeatedly add all its digits until the result has only one digi…
[LeetCode] Output Contest Matches 输出比赛匹配对
During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, li…
LintCode 在二叉查找树中插入节点
题目 给定一棵二叉查找树和一个新的树节点,将节点插入到树中。 你需要保证该树仍然是一棵二叉查找树。 分析 分别用递归和非递归两种方法实现。本质上会发现,两种方法类似 public class Solution { /**…
LeetCode算法题-Reverse Words in a String III(Java实现)
这是悦乐书的第259次更新,第272篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第126题(顺位题号是557)。给定一个字符串,您需要反转句子中每个单词中的字符顺序,同时仍保留空格和初始单…
算法笔试题之平衡点问题
平衡点问题 平衡点问题: 一个数组中的元素,如果其前面的部分等于后面的部分,那么这个点的位序就是平衡点。 比如列表numbers = [1, 3, 5, 7, 8, 25, 4, 20],25前面的总和为24,2…
Leetcode 210. Course Schedule II
There are a total of n courses you have to take, labeled from 0 to n – 1. Some courses may have prerequi…
LeetCode | ZigZag Conversion
题目: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: …
LeetCode689. Maximum Sum of 3 Non-Overlapping Subarrays
Solution1: Divide and Conquer This question asks for the three non-overlapping intervals with maximum sum. So …
[LeetCode][Search] 302. Smallest Rectangle Enclosing Black Pixels
Problem An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black p…
[LeetCode] Longest Substring Without Repeating Characters 最长无重复字符的子串,Isomorphic Strings
Given a string, find the length of the longest substring without repeating characters. Exampl…
[LeetCode] Find Largest Value in Each Tree Row 找树每行最大的结点值
You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \ 5 3 9 …