上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota... 阅读全文
posted @ 2015-07-15 16:33 mrpod2g 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Given a range [m, n] where 0 >1; n = n>>1; count++; } return m<<count; }} 阅读全文
posted @ 2015-06-28 14:02 mrpod2g 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文
posted @ 2015-06-26 17:02 mrpod2g 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"].大体思路:设置一个... 阅读全文
posted @ 2015-06-26 13:41 mrpod2g 阅读(177) 评论(0) 推荐(0) 编辑
摘要: step1:通过chkconfig --list命令查看mysqld是否在列表中;step2:如果列表中没有mysqld这个,需要先用这个命令添加:chkconfig --add mysqldstep3:然后用这个命令设置开机启动: chkconfig mysqld on 阅读全文
posted @ 2015-06-22 16:21 mrpod2g 阅读(859) 评论(0) 推荐(0) 编辑
摘要: 一.算法流程Step1:初始化一群粒子(粒子个数为50个),包括随即位置和速度;Step2:计算每个粒子的适应度fitness;Step3:对每个粒子,将其适应度与其进过的最好位置(局部)pbest做比较,如果较好,则将其作为当前的最好位置pbest;Step4:对每个粒子,将其将其适应值与群体所经... 阅读全文
posted @ 2015-06-14 15:58 mrpod2g 阅读(3350) 评论(2) 推荐(0) 编辑
摘要: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1/** * Definition for a binary tree node... 阅读全文
posted @ 2015-06-13 14:46 mrpod2g 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ... 阅读全文
posted @ 2015-06-08 15:28 mrpod2g 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integer k, return true if and only if there are two distinct indices i and j in the array such that nums[i] = nums[j... 阅读全文
posted @ 2015-05-29 15:24 mrpod2g 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-05-25 12:40 mrpod2g 阅读(721) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页