发布了文章2020-06-30
求解平方根,是多项式求解的一个最简单的特例。分别采用梯度下降和牛顿迭代解法如下。其中梯度下降的步进如何选择有点不解,迭代次数比牛顿多太多了。
发布了文章2019-01-10
Given preorder and inorder traversal of a tree, construct the binary tree.
发布了文章2019-01-10
Sort a linked list in O(n log n) time using constant space complexity.
发布了文章2017-09-13
分布式一致性协议通俗讲就是多机状态的一致性保障协议,即如果同一份状态存储在多台机器上,如何保证在多台机器上的状态彼此是一致的。一致是指读到的结果和写入的预期是一致的。
发布了文章2017-09-13
近期看了一些机器学习的书,没推导过公式,没实际动手过。适逢公司内部组织了一个点击率预估的比赛。训练数据是针对150万份图文的2亿条点展行为数据,主要有用户id、文档id、文档相关详情信息。预估一批用户点击一批文档的点击率,按auc评分。第一次实际动手,用mapr...
发布了文章2017-08-16
当然,如果度度熊使用第i个技能打在第j个怪兽上面的话,会使得第j个怪兽的生命值减少p[i]-b[j],当然如果伤害小于防御,那么攻击就不会奏效。
发布了文章2017-02-08
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
回答了问题2016-12-16
{代码...}
关注了问题2016-12-16
发布了文章2016-11-15
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
发布了文章2016-11-14
近一年没有写代码了,手痒无聊,集中刷了近一百题,前一半按序全部做了,后面的挑了有意思的做,一眼看起来太简单的且重复类型的就忽略了。最近挑的题,发现没有了自测按钮,不太方便。暂时不再刷题了。开启新的一章,学习“机器学习”,从入门开始,看书、上公开课、...
赞了文章2016-11-14
很久很久没有更新了,并不是我自己不想,确实是最近太忙了,不管是工作上还是生活上都很忙,唉,之前希望自己能够坚持写博客,没有坚持下来,最近这段时间也是,其实时间吧,能挤还是能挤出来的,但是好不容易挤出来一点时间,不是用来刷手机,就是用来看书了,因为...
发布了文章2016-11-14
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
回答了问题2016-11-14
已经找到原因。judge的答案自身对链长计算是多算了一次的。比如"hot", "dog", ["hot","dog","dot"]这个case的路径是 hot->dot->dog, 这里是变化了两次,但是链长是三。judge要求的答案是三,而不是二。将上面的代码,初始值step赋值为2,既可以ac了。对标准jud...
提出了问题2016-11-12
发布了文章2016-11-11
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
发布了文章2016-11-11
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
发布了文章2016-11-11
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
发布了文章2016-11-11
Note:A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?
发布了文章2016-11-10
Given two binary trees, write a function to check if they are equal or not.