自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Pilgrim

希望某一天跪在那片向往的圣地,满含热泪,亲吻大地,将那之前所经历的种种痛苦,笑着说出来......

  • 博客(659)
  • 资源 (1)
  • 收藏
  • 关注

原创 Leetcode 406. 根据身高重建队列

【代码】Leetcode 406. 根据身高重建队列。

2023-06-18 12:10:37 96

原创 **Leetcode 134. 加油站

按照最大连续子序列的和写 可能更容易理解一些 ,具体如上,区别是,如果遍历到数组最后,需要从头开始继续看下。

2023-05-01 17:31:16 116

原创 Leetcode 714. 买卖股票的最佳时机含手续费

【代码】Leetcode 714. 买卖股票的最佳时机含手续费。

2023-04-03 06:25:40 119

原创 *Leetcode 528. 按权重随机选择

【代码】*Leetcode 528. 按权重随机选择。

2023-04-02 14:32:10 62

原创 **Leetcode 373. 查找和最小的 K 对数字

类似第k小素分数 核心思路:pair的第二个数枚举,作为初始化,假设第二个数有m种可能,等于有m个队列,那么就等于从nums1里面逐步加入数,等价于多路合并队列 每个队列往后走一步,具体看代码。

2023-04-02 12:05:24 44

原创 **Leetcode 421. 数组中两个数的最大异或值

【代码】**Leetcode 421. 数组中两个数的最大异或值。

2023-04-02 09:14:53 32

原创 **Leetcode 786. 第 K 个最小的素数分数

【代码】*Leetcode 786. 第 K 个最小的素数分数。

2023-03-26 19:40:47 38

原创 剑指 Offer II 053. 二叉搜索树中的中序后继

【代码】剑指 Offer II 053. 二叉搜索树中的中序后继。

2023-03-19 20:13:47 37

原创 *Leetcode 1122. 数组的相对排序

【代码】*Leetcode 1122. 数组的相对排序。

2023-03-18 14:45:12 38

原创 *Leetcode 713. 乘积小于 K 的子数组

【代码】*Leetcode 713. 乘积小于 K 的子数组。

2023-03-11 16:21:44 38

原创 *Leetcode 416. 分割等和子集

Leetcode 416. 分割等和子集

2023-02-20 07:10:06 42

原创 *Leetcode 437. 路径总和 III

*Leetcode 437. 路径总和 III

2023-02-20 06:50:44 57

原创 *Leetcode 438. 找到字符串中所有字母异位词

Leetcode 438. 找到字符串中所有字母异位词

2023-02-19 19:10:03 41

原创 *Leetcode 538. 把二叉搜索树转换为累加树

Leetcode 538. 把二叉搜索树转换为累加树

2023-02-19 18:16:50 43

原创 *Leetcode 23. 合并K个升序链表

*Leetcode 23. 合并K个升序链表

2023-02-19 18:16:30 43

原创 Leetcode 448 找到所有数组中消失的数字

Leetcode 448 找到所有数组中消失的数字

2023-02-19 15:29:34 46

原创 *Leetcode 72 编辑距离

dp

2023-01-25 22:54:30 47

原创 Leetcode 198. 打家劫舍

dp

2023-01-24 08:11:01 52

原创 leetcode & 剑指 Offer 26. 树的子结构

leetcode & 剑指 Offer 26. 树的子结构

2023-01-23 17:11:56 61

原创 *Leetcode 426 & 剑指 Offer 36. 二叉搜索树与双向链表

Leetcode 426 & 剑指 Offer 36. 二叉搜索树与双向链表

2023-01-11 07:28:01 73

原创 *leetcode 343. 整数拆分 & 剑指offer 14

leetcode 343. 整数拆分 & 剑指offer 14剑指offer的代码感觉定义dp方程不清晰 此处重新写 一下

2022-12-27 02:21:04 49

原创 tf.AUTO_REUSE

通过get_variable("v")函数获取变量时,如果tf.variable_scope的reuse参数是True, 如果v是已经被创建过了就直接返回,但是如果没有创建会报错。如果设置成False,变量v如果没有被创建过就直接创建,如果创建过就报错。AUTO_REUSE的好处就是实现:如果创建过就返回,没有创建过就创建一个新的变量返回AUTO_REUSE.__doc__ = ""...

2019-07-10 15:41:41 4332 3

原创 tf实现用二维的索引从二维数组获取对应值 tf.gather_nd

a = tf.constant([[1, 2, 3], [4, 5, 6], [7, 8, 9]])inds = tf.constant([[0, 2], [2, 1], [1, 1]])#目的是实现 从[1,2,3]获取index为[0,2]的值也就是[1,3]作为第一行,从[4,5,6]获取index为[2,1]的值也就是[6,5]作为第二行, 从[7,8,9]获取index[1,...

2019-03-17 23:35:49 1587

原创 tf.nn.fixed_unigram_candidate_sampler解释

https://www.tensorflow.org/api_docs/python/tf/random/fixed_unigram_candidate_sampler上面链接是官网解释,看了一会儿感觉没看懂 跑了几个列子有点懂了。本文结合https://www.w3cschool.cn/tensorflow_python/tf_nn_fixed_unigram_candidate_...

2019-03-13 18:05:03 4554

原创 ***Leetcode 894. All Possible Full Binary Trees

https://leetcode.com/problems/all-possible-full-binary-trees/description/ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *ri...

2018-10-09 01:30:51 223

原创 *Leetcode 814. Binary Tree Pruning

https://leetcode.com/problems/binary-tree-pruning/description//** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * Tr...

2018-10-07 12:41:20 170

原创 **Leetcode 701. Insert into a Binary Search Tree

https://leetcode.com/problems/insert-into-a-binary-search-tree/description/想清楚很好写。。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * Tre...

2018-10-07 02:51:11 236

原创 **Leetcode 450. Delete Node in a BST

https://leetcode.com/problems/delete-node-in-a-bst/description/不错的题 有一些细节需要注意 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNo...

2018-10-07 01:36:08 119

原创 Leetcode 404. Sum of Left Leaves

https://leetcode.com/problems/sum-of-left-leaves/description/  /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * ...

2018-10-06 01:29:46 111

原创 ***Leetcode 881. Boats to Save People

https://leetcode.com/problems/boats-to-save-people/description/ 赤裸裸的双指针的题,,竟然没看出来。。。class Solution {public: int numRescueBoats(vector<int>& people, int limit) { sort(peop...

2018-10-06 01:09:56 297

原创 *Leetcode 874. Walking Robot Simulation

https://leetcode.com/problems/walking-robot-simulation/description/因为X<= 9 所以一步一步枚举就行。。 class Solution {public: string hash(int x, int y) { return to_string(x) + "->" + to...

2018-10-05 23:50:43 170

原创 ***Leetcode 767. Reorganize String

https://leetcode.com/problems/reorganize-string/description/套路题了如果是判断是否可行,判断条件就是最多的不能超过总长度的一半(考虑计数情况)如果是找方案 就需要优先队列了。。 struct cmp { bool operator()(const pair<int, int> & a, c...

2018-10-05 22:19:01 219

原创 *Leetcode 763. Partition Labels

https://leetcode.com/problems/partition-labels/description/const int SIZE = 256;class Solution {public: bool judge( int cnt[], int hash[] ) { // bool ret = true; for (int...

2018-10-05 18:32:43 194

原创 Leetcode 455. Assign Cookies

https://leetcode.com/problems/assign-cookies/description/bool cmp(const int a, const int b) { return a < b;}class Solution {public: int findContentChildren(vector<int>& g,...

2018-10-05 18:19:13 115

原创 ***Leetcode 435. Non-overlapping Intervals

https://leetcode.com/problems/non-overlapping-intervals/description/很不错的题 跟课程规划那个题有点相似bool cmp( const Interval& a , const Interval& b ) { if (a.start != b.start) return a.start < b...

2018-10-05 17:52:47 109

原创 *Leetcode 738. Monotone Increasing Digits

https://leetcode.com/problems/monotone-increasing-digits/description/ 这个难度的还是比较容易想的,找到最左边不合法的位置 后面都设置成9即可 需要从右向左找 因为有 3312这种case,第二个3更新之后 第一个3一样要更新。。class Solution {public: int monoton...

2018-10-05 16:46:55 166

原创 **Leetcode 659. Split Array into Consecutive Subsequences

https://leetcode.com/problems/split-array-into-consecutive-subsequences/description/这个代码 技巧性太强了 参考了http://www.cnblogs.com/grandyang/p/7525821.html基本思路就是,up维护数可能存在次数的上限,class Solution {public:...

2018-10-05 16:04:54 246

原创 ***Leetcode 316. Remove Duplicate Letters

https://leetcode.com/problems/remove-duplicate-letters/description/ 不是很容易想。如果来了一个新的字母 就考虑放在哪个位置合适,之前已经选的字母 如果后面还有,就可以暂时删除。 class Solution {public: string removeDuplicateLetters(string ...

2018-10-05 02:11:45 127

原创 *Leetcode 67. Add Binary

https://leetcode.com/problems/add-binary/description/ 手算大数减价乘除如何更简洁代码的问题。。class Solution {public: string addBinary(string a, string b) { int i = a.size() - 1, j = b.size() - 1; ...

2018-10-03 22:53:03 113

原创 ***Leetcode 376. Wiggle Subsequence

https://leetcode.com/problems/wiggle-subsequence/description/ class Solution {public: vector<int> filter(vector<int>& nums) { vector<int> ret; for ...

2018-09-29 01:29:34 120

演示数据结构的算法过程

帮助数据结构学习,用flash动画生动的演示数据结构的算法过程

2014-01-29

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除