前插法 这个题目和翻转链表不一样的地方就是它需要考虑的情况很多. pre_node cur_node tmp_node # Definition for singly-linked list. # class ListN…
分类:LeetCode
Leetcode 152. Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. F…
[LeetCode] Top K Frequent Words 前K个高频词
Given a non-empty list of words, return the k most frequent elements. Your answer should be s…
[LeetCode] Unique Morse Code Words 独特的摩斯码单词
International Morse Code defines a standard encoding where each letter is mapped to a series of dots an…
力扣(LeetCode)543
题目地址:https://leetcode-cn.com/probl…题目描述:给定一棵二叉树,你需要计算它的直径长度。一棵二叉树的直径长度是任意两个结点路径长度中的最大值。这条路径可能穿过根结点。 示例 :…
LeetCode | Divide Two Integers(两个数相除)
Divide two integers without using multiplication, division and mod operator. 题目解析: 求两个数相除,不能用乘除法。那么可以用加减法一点一点算…
京东2017编程题(1)
第一题 [编程题] 进制均值 时间限制:1秒 空间限制:32768K 尽管是一个CS专业的学生,小B的数学基础很好并对数值计算有着特别的兴趣,喜欢用计算机程序来解决数学问题,现在,她正在玩一个数值变换的游戏。她发现计算机…
581. Shortest Unsorted Continuous Subarray
题目解析 Given an integer array, you need to find one continuous subarray that if you only sort this sub…
Leetcode之1-两数之和I(Two Sum)
前言 个人网站 公众号: 北京程序猿, 网站 : https://yaml.vip 算法真的重要么 有很多开发者可能有个疑问,平时写代码几乎用不到算法,为何出去面试时几乎所有公司都会面试算法题。 我相信有这个疑问的程序员…
[LeetCode] Top K Frequent Elements 前K个高频元素
Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: n…
[LeetCode] Cut Off Trees for Golf Event 为高尔夫赛事砍树
You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negativ…
244. Shortest Word Distance II My Submissions Question
Problem This is a follow up of Shortest Word Distance. The only difference is now you are given the list of wo…