摘要: 题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目只有一句话:把一个按升序排列的数组,装换成一个平衡二叉树。 代码: 很久没研究数据结构了,先 阅读全文
posted @ 2016-09-16 12:47 PolarBearInterest 阅读(938) 评论(0) 推荐(0) 编辑
摘要: 题目: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following seq 阅读全文
posted @ 2016-09-13 15:09 PolarBearInterest 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up: Ca 阅读全文
posted @ 2016-09-12 19:56 PolarBearInterest 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 阅读全文
posted @ 2016-09-09 15:59 PolarBearInterest 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return 代码: 仔细一看,规律就是本层第一个和最后一个的元素都是1,其他的元素分别等于上一层同 阅读全文
posted @ 2016-09-08 14:38 PolarBearInterest 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac 阅读全文
posted @ 2016-09-05 17:57 PolarBearInterest 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 最近在学习Python,今天发现Django如此强大的web框架,不得不来试一试。 1. 安装Python,官网建议用Python3: 于是乎,下载Python-3.4.1.tgz,解压,安装: ./configure ./make ./make install 当然安装的时候可能需要gcc,不然c 阅读全文
posted @ 2016-08-23 01:07 PolarBearInterest 阅读(598) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Follow up: Did you use extra space? A straight forwa 阅读全文
posted @ 2016-08-01 02:22 PolarBearInterest 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted i 阅读全文
posted @ 2016-07-28 00:32 PolarBearInterest 阅读(148) 评论(0) 推荐(0) 编辑