李博Garvin的专栏

阿里云机器学习PD

单链表问题(反转、是否有环、删除结尾第N个节点、合并两个sortlist、找到交点)

1.时间复杂度O(N),内存O(1)的效率下实现单链表的翻转public static TreeNode revers(TreeNode head){ TreeNode temp,first,second; first=head; second=head.next; while(...

2015-03-26 15:21:00

阅读数:1699

评论数:0

面试总结-百度(1)

百度数据挖掘部门       自我介绍,扯了一些项目方面的东西,就是简历上的,然后开始写代码,最后问你有没有什么问题。题目如下:(1)用两个栈实现一个队列(优化后解)public class QueueImplementByTwoStacks { Stack a=n...

2015-03-25 15:57:09

阅读数:1593

评论数:2

【LeetCode从零单排】No96 Unique Binary Search Trees

题目Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BS...

2015-03-24 17:09:02

阅读数:1348

评论数:0

【LeetCode从零单排】No129 Sum Root to Leaf Numbers

题目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-&g...

2015-03-23 15:16:54

阅读数:1063

评论数:0

【LeetCode从零单排】No15 3Sum

题目Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum ...

2015-03-20 16:39:36

阅读数:980

评论数:0

苹果系统修复若干办法

在经典系统,可以在重新启动时按Shift键,将第三方的功能扩展关闭,使机子能完成启动,之后再设法修复磁盘错误或功能扩展冲突的问题。重新启动,当所有功能扩展的上载完成后,立即按下Option+Command键,直到出现重建桌面文件的窗口,点击OK,可以重建桌面文件,修复因桌面文件出错引起的问题。即使...

2015-03-20 13:35:20

阅读数:927

评论数:0

【LeetCode从零单排】No 3 Longest Substring Without Repeating Characters

题目Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...

2015-03-17 16:33:47

阅读数:1209

评论数:0

【LeetCode从零单排】No 114 Flatten Binary Tree to Linked List

题目Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6 The fla...

2015-03-16 14:57:08

阅读数:1186

评论数:0

【LeetCode从零单排】No 191.Number of 1 Bits(考察位运算)

题目Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bi...

2015-03-13 15:50:15

阅读数:4309

评论数:2

Kmeans、Kmeans++和KNN算法比较

K-Means介绍       K-means算法是聚类分析中使用最广泛的算法之一。它把n个对象根据他们的属性分为k个聚类以便使得所获得的聚类满足:同一聚类中的对象相似度较高;而不同聚类中的对象相似度较小。其聚类过程可以用下图表示:        如图所示,数据样本用圆点表示,每个簇的中心点用叉叉...

2015-03-12 16:34:03

阅读数:1120

评论数:0

【LeetCode从零单排】No189 .Rotate Array

题目Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].No...

2015-03-12 16:12:35

阅读数:1239

评论数:0

【LeetCode从零单排】No.169 Majority Element(hashmap用法)

题目Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that t...

2015-03-12 11:26:57

阅读数:1263

评论数:0

【LeetCode从零单排】No.160 Intersection of Two Linked Lists

题目Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: ...

2015-03-10 14:28:15

阅读数:1104

评论数:0

【LeetCode从零单排】No118 Pascal's Triangle

题目Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1],...

2015-03-09 15:10:31

阅读数:1276

评论数:0

linux||mac os如何自定义shell命令

博主是goagent忠实用户,但是在mac下每次启动goagent都要cd到proxy的目录下,然后再执行proxy.py文件,非常麻烦,所以博主想到能否自己定义一个shell命令,一健启动goagent,其实也很简单,过程如下。(1)我们在user目录下输入,"-a"是现实隐...

2015-03-06 11:00:19

阅读数:3256

评论数:0

【LeetCode从零单排】No112 Path Sum

题目Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum...

2015-03-04 16:48:47

阅读数:1381

评论数:0

【LeetCode从零单排】No104 Maximum Depth of Binary Tree

题目Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest...

2015-03-04 14:51:02

阅读数:1283

评论数:0

【LeetCode从零单排】No102 Binary Tree Level Order Traversal

题目       Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binar...

2015-03-03 16:22:03

阅读数:1305

评论数:2

【LeetCode从零单排】No100 Same Tree && No101 Symmetric Tree

题目1.same treeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurall...

2015-03-02 16:10:29

阅读数:1231

评论数:0

【LeetCode从零单排】No83 Remove Duplicates from Sorted List

题目Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1-&...

2015-03-02 11:18:50

阅读数:1179

评论数:0

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