相交链表 编写一个程序,找到两个单链表相交的起始节点。 A: a1 → a2 ↘ c1 → c2 → c3 ↗ B: b1 → b2 → b3 注意: 如果两个链表没有交点,返回 null. …
分类:LeetCode
LeetCode[5] - Binary Tree Right Side View
自己想了这个方法,有可能不是特别efficient. 一个queue放普通的BFS。 一个queue放level。 同时维护一个parent value;维护一个跟着BFS跑的level。 每个node都有一个lv。一旦…
[LeetCode] Remove Duplicates from Sorted Array II 有序数组中去除重复项之二
Follow up for “Remove Duplicates”:What if duplicates are allowed at most twice? For ex…
[LeetCode] Maximum Swap 最大置换
Given a non-negative integer, you could swap two digits at most once to get the maximum value…
[LeetCode] Max Chunks To Make Sorted II 可排序的最大块数之二
This question is the same as “Max Chunks to Make Sorted” except the integers of the given a…
[Leetcode] Verify Preorder Sequence in Binary Search Tree 验证先序序列
Verify Preorder Sequence in Binary Search Tree Given an array of numbers, verify whether it is the correct pre…
[array] leetcode-55. Jump Game - Medium
leetcode-55. Jump Game – Medium descrition Given an array of non-negative integers, you are initially po…
290. Word Pattern
290. Word Pattern 题目: https://leetcode.com/problems/word-pattern/ 难度 : Easy 4.pattern = “abba”, st…
最大正方形
在一个二维01矩阵中找到全为1的最大正方形 您在真实的面试中是否遇到过这个题? Yes 样例 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 返回 4 题目地址 解题思路 动态规划的办法,…
[LeetCode][Search] 339. Nested List Weight Sum
Problem More LeetCode Discussions Given a nested list of integers, return the sum of all integers in the list …
27. Remove Element
27. Remove Element 题目 Given an array and a value, remove all instances of that value in-place and return the n…
[LeetCode] Count Univalue Subtrees 计数相同值子树的个数
Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the…