Pilgrim

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

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...

2019-03-17 23:35:49

阅读数 50

评论数 0

tf.nn.fixed_unigram_candidate_sampler解释

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

2019-03-13 18:05:03

阅读数 145

评论数 0

***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 { * ...

2018-10-09 01:30:51

阅读数 57

评论数 0

*Leetcode 814. Binary Tree Pruning

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

2018-10-07 12:41:20

阅读数 39

评论数 0

**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 ...

2018-10-07 02:51:11

阅读数 76

评论数 0

**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 { ...

2018-10-07 01:36:08

阅读数 28

评论数 0

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; ...

2018-10-06 01:29:46

阅读数 31

评论数 0

***Leetcode 881. Boats to Save People

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

2018-10-06 01:09:56

阅读数 58

评论数 0

*Leetcode 874. Walking Robot Simulation

https://leetcode.com/problems/walking-robot-simulation/description/ 因为X<= 9 所以一步一步枚举就行。。  class Solution { public: string hash...

2018-10-05 23:50:43

阅读数 38

评论数 0

***Leetcode 767. Reorganize String

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

2018-10-05 22:19:01

阅读数 44

评论数 0

*Leetcode 763. Partition Labels

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

2018-10-05 18:32:43

阅读数 42

评论数 0

Leetcode 455. Assign Cookies

https://leetcode.com/problems/assign-cookies/description/ bool cmp(const int a, const int b) { return a < b; } class Solution { pu...

2018-10-05 18:19:13

阅读数 32

评论数 0

***Leetcode 435. Non-overlapping Intervals

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

2018-10-05 17:52:47

阅读数 29

评论数 0

*Leetcode 738. Monotone Increasing Digits

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

2018-10-05 16:46:55

阅读数 31

评论数 0

**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 ...

2018-10-05 16:04:54

阅读数 45

评论数 0

***Leetcode 316. Remove Duplicate Letters

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

2018-10-05 02:11:45

阅读数 34

评论数 0

*Leetcode 67. Add Binary

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

2018-10-03 22:53:03

阅读数 23

评论数 0

***Leetcode 376. Wiggle Subsequence

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

2018-09-29 01:29:34

阅读数 26

评论数 0

***Leetcode 692. Top K Frequent Words

https://leetcode.com/problems/top-k-frequent-words/description/ 用于练习优先队列了。。实际排序也行 struct cmp { bool operator() (const auto& a, cons...

2018-09-19 19:28:53

阅读数 42

评论数 0

***Leetcode 297. Serialize and Deserialize Binary Tree

https://leetcode.com/problems/serialize-and-deserialize-binary-tree/description/ /** * Definition for a binary tree node. * struct TreeNode { * ...

2018-09-17 01:15:51

阅读数 36

评论数 0

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