11 2020 档案

236. Lowest Common Ancestor of a Binary Tree
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文

posted @ 2020-11-29 17:39 wsw_seu 阅读(66) 评论(0) 推荐(0) 编辑

237. Delete Node in a Linked List
摘要:Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to t 阅读全文

posted @ 2020-11-29 16:43 wsw_seu 阅读(56) 评论(0) 推荐(0) 编辑

238. Product of Array Except Self
摘要:Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except n 阅读全文

posted @ 2020-11-29 16:25 wsw_seu 阅读(42) 评论(0) 推荐(0) 编辑

单调队列 Monotonic Queue应用:leetcode(未完待续)
摘要:239. Sliding Window Maximum 581: https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ 862: https://leetcode.com/problems/shortest-suba 阅读全文

posted @ 2020-11-22 15:32 wsw_seu 阅读(153) 评论(0) 推荐(0) 编辑

240. Search a 2D Matrix II
摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i 阅读全文

posted @ 2020-11-22 10:23 wsw_seu 阅读(173) 评论(0) 推荐(0) 编辑

一致性Hash算法(原创发布于慕课网)
摘要:一致性哈希算法在1997年由麻省理工学院的Karger等人在解决分布式Cache中提出的,设计目标是为了解决因特网中的热点(Hot spot)问题,初衷和CARP十分类似。一致性哈希修正了CARP使用的简单哈希算法带来的问题,使得DHT可以在P2P环境中真正得到应用。 但现在一致性hash算法在分布 阅读全文

posted @ 2020-11-22 10:03 wsw_seu 阅读(94) 评论(0) 推荐(0) 编辑

279. Perfect Squares(dp)
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 O 阅读全文

posted @ 2020-11-21 22:18 wsw_seu 阅读(106) 评论(0) 推荐(0) 编辑

283. Move Zeroes(双指针)
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Input: 阅读全文

posted @ 2020-11-18 23:17 wsw_seu 阅读(59) 评论(0) 推荐(0) 编辑

287. Find the Duplicate Number
摘要:Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one duplicate number in n 阅读全文

posted @ 2020-11-18 23:15 wsw_seu 阅读(108) 评论(0) 推荐(0) 编辑

289. Game of Life
摘要:According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John 阅读全文

posted @ 2020-11-15 13:22 wsw_seu 阅读(106) 评论(0) 推荐(0) 编辑

315. Count of Smaller Numbers After Self(二分或者算法导论中的归并求逆序数对)
摘要:You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smal 阅读全文

posted @ 2020-11-15 11:00 wsw_seu 阅读(94) 评论(0) 推荐(0) 编辑

dp:322. Coin Change 自下而上的dp
摘要:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文

posted @ 2020-11-11 21:56 wsw_seu 阅读(119) 评论(0) 推荐(0) 编辑

328. Odd Even Linked List
摘要:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文

posted @ 2020-11-08 19:39 wsw_seu 阅读(55) 评论(0) 推荐(0) 编辑

329. Longest Increasing Path in a Matrix(核心在于缓存遍历过程中的中间结果)
摘要:Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文

posted @ 2020-11-08 11:58 wsw_seu 阅读(101) 评论(0) 推荐(0) 编辑

451. Sort Characters By Frequency(桶排序)
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: "tree" Output: "eert" Explanation: 'e' appears twi 阅读全文

posted @ 2020-11-08 10:48 wsw_seu 阅读(83) 评论(0) 推荐(0) 编辑

leetcode bitmap系列问题整理
摘要:1、 题目: 编写一个函数,输入是一个无符号整数,返回其二进制表达式中数字位数为 ‘1’ 的个数(也被称为汉明重量)。 示例 : 输入: 11输出: 3解释: 整数 11 的二进制表示为 00000000000000000000000000001011 示例 2: 输入: 11输出: 3解释: 整数 阅读全文

posted @ 2020-11-07 10:10 wsw_seu 阅读(281) 评论(0) 推荐(0) 编辑

334. Increasing Triplet Subsequence(也可以使用dp动态规划)
摘要:Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return true if 阅读全文

posted @ 2020-11-05 22:30 wsw_seu 阅读(84) 评论(0) 推荐(0) 编辑

c++ priority_queue应用(重要)
摘要:自定义排序 重写仿函数 struct cmp{ bool operator() ( Node a, Node b ){//默认是less函数 //返回true时,a的优先级低于b的优先级(a排在b的后面) if( a.x== b.x ) return a.y> b.y; return a.x> b. 阅读全文

posted @ 2020-11-04 21:32 wsw_seu 阅读(193) 评论(0) 推荐(0) 编辑

378. Kth Smallest Element in a Sorted Matrix(大顶堆、小顶堆)
摘要:Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th 阅读全文

posted @ 2020-11-01 17:05 wsw_seu 阅读(92) 评论(0) 推荐(0) 编辑

395. Longest Substring with At Least K Repeating Characters
摘要:Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than  阅读全文

posted @ 2020-11-01 11:48 wsw_seu 阅读(56) 评论(0) 推荐(0) 编辑

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示