- 博客(29)
- 收藏
- 关注
转载 scikit-learn ubuntu安装
scikit-learn的官方网站:http://scikit-learn.org github网址:https://github.com/scikit-learn/scikit-learn安装各种依赖的包sudo apt-get install build-essential python-dev python-numpy python-setuptools python-scipy libat
2017-06-01 16:48:44 373
原创 LeetCode OJ-48-Rotate Image
题目:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise).大意:n×n二维矩阵顺时针旋转90°,求旋转后的数组。思路:找到 matrix[i][j] = matrix[n-1-j][i] 的规律。代码:public class Solution {
2016-10-18 11:43:56 289
转载 LeetCode OJ-44-Permutations
题目:Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3
2016-10-13 17:15:13 214
原创 LeetCode OJ-43-Multiply Strings
题目:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. Converting the input string to integer
2016-10-13 12:06:42 207
原创 LeetCode OJ-42-Trapping Rain Water
题目: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,
2016-10-13 10:20:20 199
原创 LeetCode OJ-41-First Missing Positive
题目:Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant s
2016-10-12 17:33:05 218
原创 LeetCode OJ-40-Combination Sum II
题目: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in the combina
2016-10-11 20:44:33 242
原创 LeetCode OJ-39-Combination Sum
题目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number
2016-10-10 21:33:46 209
原创 LeetCode OJ-38-Count and Say
题目:The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, …1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read off as “one 2,
2016-10-10 15:26:02 294
原创 LeetCode OJ-36-Valid Sudoku
题目:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A partially filled sudo
2016-10-10 11:47:59 164
原创 LeetCode OJ-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 be if it were inserted in order. You may assume no duplicates in the array.
2016-10-10 10:03:57 179
原创 LeetCode OJ-34-Search for a Range
题目:Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm’s runtime complexity must be in the order of O(log n). If the target is not found in
2016-09-30 11:15:59 224
原创 LeetCode OJ-31-Next Permutation
题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible
2016-09-29 14:09:06 235
原创 LeetCode OJ-28-Implement strStr()
题目:Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.大意:实现实现strStr()函数,判断一个字符串在另一个字符串中出现的位置。如果不匹配就返回-1。思路:找到needle首字母在haystac
2016-09-28 17:25:33 204
原创 LeetCode OJ-27-Remove Element
题目: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory.
2016-09-28 17:15:27 176
原创 LeetCode OJ-26-Remove Duplicates from Sorted Array
题目: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 space for another array, you must do this in place with
2016-09-28 17:03:22 173
原创 LeetCode OJ-24-Swap Nodes in Pairs
题目:Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. You
2016-09-27 16:08:28 263
原创 LeetCode OJ-23-Merge k Sorted Lists
题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.大意: 合并k个排好的的单链表。分析和描述它的复杂性。思路: 使用小顶堆来实现,先将K个链表的头结点入堆,取堆顶元素,这个结点就是最小的,接着让取出的这个结点的下一个结点入堆,再取堆顶元素,其
2016-09-26 14:28:17 198
原创 LeetCode OJ-22-Generate Parentheses
题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())",
2016-09-22 17:12:36 314
原创 LeetCode OJ-20-Valid Parentheses
题目:Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets must close in the correct order, “()” and “()[]{}” are all valid
2016-09-22 11:54:20 171
转载 LeetCode OJ-18-4Sum
题目:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.For example, given arr
2016-09-20 11:42:13 201
转载 LeetCode OJ-17-Letter Combinations of a Phone Number
题目:Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string
2016-09-19 16:22:41 248
转载 LeetCode OJ-16-3Sum Closest
题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exa
2016-09-19 10:18:17 186
原创 JAVA中堆和栈的区别
在函数中定义的一些基本类型的变量和对象的引用变量都在函数的栈内存中分配。 当在一段代码块定义一个变量时,Java就在栈中为这个变量分配内存空间,当超过变量的作用域后,Java会自动释放掉为该变量所分配的内存空间,该内存空间可以立即被另作他用。 堆内存用来存放由new创建的对象和数组。 在堆中分配的内存,由Java虚拟机的自动垃圾回收器来管理。 在堆中产生了一个数组或对象后,还可以在栈
2016-09-18 21:47:33 131
原创 LeetCode OJ-15-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 of zero. For example, given array S = [-1, 0, 1, 2
2016-09-18 21:35:04 181
原创 LeetCode OJ-14-Longest Common Prefix
题目:Write a function to find the longest common prefix string amongst an array of strings.大意:写一个函数找出一个字符串数组中的最长的公共前缀。思路:采用OJ给出的前三种方法。 方法1:宽度扫描。设字符串数组的长度为prefix,将prefix的值初始化为数组的第一个元素,从数组的第二个元素开始利用indexO
2016-09-12 14:42:58 248
转载 LeetCode OJ-13-Roman to Integer
题目:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.大意:给定一个罗马数字,将其转换成对应的整数。 输入的数字在1-3999之间。思路:根据罗马数字与整数的对应关系进行加减法操作,从低位向高位计算,若高位比低位的数字小则减
2016-09-11 23:49:26 276
转载 欢迎使用CSDN-markdown编辑器
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl
2016-09-11 23:36:52 153
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人