上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 16 下一页
摘要: 101. Symmetric Tree 解题思路: 递归的方法如下。分几种情况考虑,如果左子树和右子树都是空,那么返回true;如果不同时为空,返回false;如果都不为空,则 判断其值是否相等,不相等为false,相等再判断左子树的左子树与右子树的右子树,左子树的右子树与右子树的左子树。 非递归的 阅读全文
posted @ 2017-03-16 15:29 陆离可 阅读(132) 评论(0) 推荐(0)
摘要: 409. Longest Palindrome Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built 阅读全文
posted @ 2017-03-14 11:09 陆离可 阅读(149) 评论(0) 推荐(0)
摘要: pip list 查看已安装的python包及版本。 使用zip()函数来可以把列表合并,并创建一个元组对的列表。但是在python3中,zip的返回值是一个位置,需要用list()将其转化为tuple python -m py_compile file.py编译生成.pyc文件 graphlan_ 阅读全文
posted @ 2017-03-13 15:38 陆离可 阅读(169) 评论(0) 推荐(0)
摘要: exploratory data analysis (EDA) is an approach to analyzing data sets to summarize their main characteristics, often with visual methods. In this book 阅读全文
posted @ 2017-03-11 13:31 陆离可 阅读(156) 评论(0) 推荐(0)
摘要: DFS算法: 应用:1) 判断顶点u与v之间是否存在路径2) 判断一个无向图是否连通 112. Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding 阅读全文
posted @ 2017-03-11 10:13 陆离可 阅读(194) 评论(0) 推荐(0)
摘要: 35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would b 阅读全文
posted @ 2017-03-10 22:17 陆离可 阅读(111) 评论(0) 推荐(0)
摘要: 278. First Bad Version You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your prod 阅读全文
posted @ 2017-03-10 12:18 陆离可 阅读(98) 评论(0) 推荐(0)
摘要: 思路: 随机选取列表中的一个值v,然后将列表分为小于v的,等于v的,大于v的三组。对于k<=left.size()时, 在left中执行selection;落在中间的,返回v;k>left.size()+mid.size()时,在right中执行selection。 需要注意rand()函数的使用。 阅读全文
posted @ 2017-03-07 23:03 陆离可 阅读(143) 评论(0) 推荐(0)
摘要: void deleteNode(ListNode* node) { *node = *node->next; } 阅读全文
posted @ 2017-03-07 13:18 陆离可 阅读(86) 评论(0) 推荐(0)
摘要: 解题思路: 这道题需要注意的是s和t长度相等,但都为空的情况。只需要扫描一遍s建立字典(char, count),然后扫描t,如果有 未出现的字母,或者键值小于0,就可以返回false了。 但是,因为题目中说是小写字母,所以可以用数组来做。思路类似,相比使用map插入更简单。 与这道题类似的是这个: 阅读全文
posted @ 2017-03-07 11:13 陆离可 阅读(165) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 16 下一页