LeetCode
水泽木兰@野蛮生长
每天进步一点点
展开
-
572. Subtree of Another Tree
题目描述:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this...原创 2018-07-09 21:52:36 · 152 阅读 · 0 评论 -
贪心力扣题解
此博主要是看了这篇的总结:https://github.com/CyC2018/CS-Notes/blob/master/notes/Leetcode 题解 - 贪心思想.md455. Assign Cookies分配饼干描述:每个孩子都有一个满足度,每个饼干都有一个大小,只有饼干的大小大于等于一个孩子的满足度,该孩子才会获得满足。求解最多可以获得满足的孩子数量。实例:Input: [1...转载 2019-08-01 22:09:50 · 287 阅读 · 0 评论 -
快排+堆排序+桶排序
快速排序分而治之思路,设置一个基准数,然后将数组分成两组,大于基准数和小于基准数。def quick_sort(lis, i, j): if i > j: return temp = lis[i] l, r = i, j while l < r: while l < r and lis[r] >= te...原创 2019-08-03 14:55:00 · 284 阅读 · 0 评论 -
关于链表的题
2 add 2 numbers题目描述You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the tw...原创 2019-07-20 22:13:57 · 139 阅读 · 0 评论 -
2sum && 3sum 在数组中寻找几个数之和为target
2sum题目描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use...原创 2019-07-20 16:50:13 · 256 阅读 · 0 评论 -
[leetcode]【最长子序列】----python
题目描述:给定一串数组,返回其中的最长递增子序列的长度。例如:给定数组[10, 9, 2, 5, 3, 7, 101, 18],则其最长递增子序列为[2, 3, 7, 101],返回长度4解题思路:用i来遍历从第二个元素开始,用j来便利i前面的数,判断J指向的元素是否小于i指向的元素?如果成立,则j对应的L序列+1和当前的i相比取大者,以此类推 10 9 2 5...原创 2018-09-11 21:37:27 · 998 阅读 · 0 评论 -
647. Palindromic Substrings
Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consist ...原创 2018-07-21 10:28:59 · 144 阅读 · 0 评论 -
581. Shortest Unsorted Continuous Subarray
题目描述:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to fi...原创 2018-07-11 11:33:20 · 124 阅读 · 0 评论 -
leetcode--406. Queue Reconstruction by Height
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of this ...原创 2018-07-17 10:47:30 · 129 阅读 · 0 评论 -
437. Path Sum III
题目描述:You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it mu...原创 2018-07-11 10:32:12 · 130 阅读 · 0 评论 -
拼多多笔试
def decrease(A, B): for i, v in enumerate(A): if i == 0: pre = True next = True if A[i + 1] - v > 0 else False elif i == len(A)-1: pre = Tru...原创 2019-08-08 21:48:00 · 452 阅读 · 0 评论