- 博客(160)
- 资源 (9)
- 收藏
- 关注
原创 conda使用手册
1、conda管理1.1、conda的安装(增)可以参考官方文档,官方下载页面1.2、 卸载conda(删)rm -rf ~/anaconda2rm -rf ~/anaconda31.3、更新conda版本(改)conda update conda1.4、conda信息查询查看conda的版本信息conda --version查看conda的帮助信息conda --helpconda -h2、conda环境管理2.1、conda环境的创建(增)直接创建新环境
2020-12-12 19:15:07
619
原创 Evaluate Reverse Polish Notation
题目Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples:
2014-06-30 19:54:36
453
原创 LRU Cache
题目Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of
2014-06-30 19:49:51
524
原创 Binary Tree Postorder Traversal
题目Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Rec
2014-06-30 19:47:48
563
原创 Binary Tree Preorder Traversal
题目Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recu
2014-06-30 19:46:14
654
原创 Reorder List
题目Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, re
2014-06-30 19:44:33
536
原创 Linked List Cycle II
题目Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?方法 public ListNode de
2014-06-30 19:38:49
541
原创 Linked List Cycle
题目Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?方法/** * Definition for singly-linked list. * class ListNode {
2014-06-30 19:37:21
466
原创 Copy List with Random Pointer
题目A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.方法 publi
2014-06-30 13:53:38
517
原创 Single Number II
题目Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it
2014-06-30 13:30:22
549
原创 Single Number
题目Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it witho
2014-06-30 13:28:16
536
原创 Gas Station
题目There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from s
2014-06-30 13:24:34
692
原创 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 6The flattened tree should look lik
2014-06-30 13:19:42
487
原创 Max Points on a Line
题目Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.方法每次选择一个点,和其他n - 1个点,进行判断,统计最多的。 double computeSlope(Point a, Point b) {
2014-06-29 20:13:40
511
原创 Candy
题目There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have
2014-06-29 19:17:50
508
原创 Clone Graph
题目Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separa
2014-06-29 15:26:40
738
原创 Word Ladder II
题目Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate w
2014-06-29 13:21:14
640
原创 Word Ladder
题目Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach interme
2014-06-29 10:30:39
691
原创 Longest Consecutive Sequence
题目Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence
2014-06-28 22:44:45
510
原创 Distinct Subsequences
题目Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some
2014-06-28 22:09:18
457
原创 Scramble String
题目Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great /
2014-06-28 19:22:49
652
原创 Minimum Window Substring
题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum wi
2014-06-28 18:42:47
515
原创 Set Matrix Zeroes
题目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 forward solution using O(mn) space is probab
2014-06-28 15:28:52
586
原创 Edit Distance
题目Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitte
2014-06-28 14:50:01
501
原创 Simplify Path
题目Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case w
2014-06-28 12:47:36
511
原创 Text Justification
题目Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approa
2014-06-28 11:39:18
587
原创 Minimum Path Sum
题目Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down
2014-06-28 11:03:07
541
原创 N-Queens II
题目Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.方法和上题方法一样,使用回溯法,结构基本相同,只需要返回数量。 public i
2014-06-28 10:45:17
500
原创 N-Queens
题目The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-que
2014-06-28 10:37:19
511
原创 Median of Two Sorted Arrays
题目There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).方法转换为寻找第k大的数。
2014-06-28 09:56:35
594
原创 Permutations II
题目Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1],
2014-06-27 20:45:34
498
原创 Permutations
题目Given a collection of 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], and [3,2,1].
2014-06-27 20:42:58
487
原创 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,
2014-06-27 20:40:41
508
原创 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 u
2014-06-26 23:06:23
469
原创 Sudoku Solver
题目Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.
2014-06-26 16:21:00
1365
原创 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 par
2014-06-26 14:45:11
1389
原创 Substring with Concatenation of All Words
题目You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once an
2014-06-26 13:36:30
576
原创 Container With Most Water
题目Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (
2014-06-24 12:26:23
435
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人