02 2017 档案
摘要:Total Accepted: 57856Total Submissions: 137040Difficulty: MediumContributors: AdminGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking ...
        阅读全文
            
摘要:Total Accepted: 133535Total Submissions: 292943Difficulty: EasyContributors: AdminWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed t...
        阅读全文
            
摘要:初始值 slow = fast = head;如果使用fast && fast->next && fast->next->next 作为快慢指针循环条件,返回的mid如下:1,2,3,4,5 31,2,3,4,5,6 31,2,3,4,5,6,7 4....即偶数个时候,返回的是左半边最后一个如果使用fast && fast->next 作为快慢指针循环条件,返...
        阅读全文
            
摘要:Total Accepted: 88244Total Submissions: 277193Difficulty: EasyContributors: AdminGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?来源: h...
        阅读全文
            
摘要:Total Accepted: 99807Total Submissions: 319528Difficulty: EasyContributors: AdminRemove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --...
        阅读全文
            
摘要:Total Accepted: 84681Total Submissions: 341465Difficulty: MediumContributors: AdminGiven 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...
        阅读全文
            
摘要:1. 首先使用 docker images 查看已有镜像:2. 获得 docker-whale 的 IMAGE ID,然后为 docker-whale 镜像 image 打上标签 Tag。使用命令:3. 再次运行 docker images,会发现有一个和docker-whale IMAGE ID一模一样的镜像,yourname/docker-whale4. 在powershell中登录 dock...
        阅读全文
            
摘要:docker run 命令镜像(image):An image is a filesystem and parameters to use at runtime. It doesn’t have state and never changes容器(container): A container is a running instance of an image.简言之,容器是镜像的实例。运行命令的...
        阅读全文
            
摘要:Total Accepted: 98004Total Submissions: 368319Difficulty: MediumContributors: AdminA linked list is given such that each node contains an additional random pointer which could point to any node in the...
        阅读全文
            
摘要:原文:https://docs.docker.com/engine/getstarted-voting-app/deploy-app/在这一步中,将会使用第一步提到的 docker-stack.yml 文件来部署 voting 应用,到我们之前创建的集群swarm中。复制 docker-stack.yml 到 manager 虚拟机docker-stack.yml 文件必须在 manager ma...
        阅读全文
            
摘要:原文:https://docs.docker.com/engine/getstarted-voting-app/create-swarm/ 初始化集群 Swarm1. 使用 ssh 命令登录 manager 虚拟机:PS C:\Users\Administrator> docker-machine ssh manager ## . ...
        阅读全文
            
摘要:原文:https://docs.docker.com/engine/getstarted-voting-app/node-setup/部署voting app的第一步,是为集群节点(swarm nodes)创建 Docker machines。我们可以在不同的实体PC、虚拟机或者云服务器上创建这些 Docker化 的主机。在本例中,我们使用Docker Machine来创建两个虚拟机(virtua...
        阅读全文
            
摘要:原文:https://docs.docker.com/engine/getstarted-voting-app/#/docker-stacks-and-services你将会学习什么 本文创建了一个基于web的投票voting应用,会收集,匹配,并返回投票结果(你选择的是cats,dogs还是其他)。这个投票app包括多个服务,每个都在独自的container容器中运行。 我们会将app...
        阅读全文
            
摘要:这是StackOverflow上的一个问题及其回答的翻译(原文:Docker.io跟一般的虚拟机有什么区别?)。原文主要回答了三个问题:1. Docker.io的基本原理是什么?2. 为什么在docker中部署软件很方便?3. docker是如何保存系统镜像的?前两个问题是主问题,最后一个问题是有人在评论中提出的,原作者也做了回答。问题:我正在学习Docker.io的文档(http://docs....
        阅读全文
            
摘要:Docker Engine当人们提到 Docker,一般而言,大家说的是 Docker Engine,如下图: 它是一个 client-server application。Docker Engine 由三个部分组成:Docker 进程(Docker Daemon)REST API:指定了和进程交互的接口CLI(command line interface):通过 REST API 和 daemo...
        阅读全文
            
摘要:首先进入阿里云docker库首页 https://dev.aliyun.com/点击 管理中心 点击 加速器复制下面的加速地址进入docker的 Settings把basic 切换成 advanced,并在 registry-mirrors: 中填入刚刚复制的加速地址应用后即可 null
        阅读全文
            
摘要:Total Accepted: 89180Total Submissions: 281459Difficulty: MediumContributors: AdminGiven a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equ...
        阅读全文
            
摘要:Total Accepted: 97678Total Submissions: 339601Difficulty: MediumContributors: AdminGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the orig...
        阅读全文
            
摘要:Total Accepted: 163106Total Submissions: 417745Difficulty: EasyContributors: AdminGiven a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, r...
        阅读全文
            
摘要:Total Accepted: 96273Total Submissions: 399212Difficulty: MediumContributors: AdminGiven a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL...
        阅读全文
            
摘要:Total Accepted: 65867Total Submissions: 304513Difficulty: MediumContributors: AdminGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30,...
        阅读全文
            
摘要:Total Accepted: 102820Total Submissions: 331280Difficulty: MediumContributors: AdminGiven a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify t...
        阅读全文
            
摘要:Total Accepted: 158161Total Submissions: 443008Difficulty: EasyContributors: AdminGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Subscribe ...
        阅读全文
            
摘要:Total Accepted: 191329Total Submissions: 435675Difficulty: EasyContributors: AdminReverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement...
        阅读全文
            
摘要:Sort a linked list in O(n log n) time using constant space complexity.Total Accepted: 94368Total Submissions: 342453Difficulty: MediumContributors: Admin分析首先可以使用和147相同的思想,把数字复制到vector 中,然后排序,再赋值回去1234...
        阅读全文
            
摘要:Total Accepted: 92484Total Submissions: 288998Difficulty: MediumContributors: AdminSort a linked list using insertion sort.分析按照传统的插入方法,对list进行排序 56ms123456789101112131415161718192021222324252627282930...
        阅读全文
            
摘要:Total Accepted: 83528Total Submissions: 314574Difficulty: HardContributors: AdminGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume ...
        阅读全文
            
摘要:Total Accepted: 105470Total Submissions: 367141Difficulty: MediumContributors: AdminGiven a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return...
        阅读全文
            
摘要:Given a singly linked list L: L0 → L1 → … → Ln-1 → Lnreorder it to: L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → …Have you met this question in a real interview? YesExampleGiven 1->2->3->4->null, reorder it to 1...
        阅读全文
            
摘要:Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the two lists and sorted in ascending order.Have you ...
        阅读全文
            
摘要:Insert a node in a sorted linked list.Have you met this question in a real interview? YesExampleGiven list = 1->4->6->8 and val = 5.Return 1->4->5->6->8.分析123456789101112131415161718192021222324252627...
        阅读全文
            
摘要:Given a linked list, determine if it has a cycle in it.Have you met this question in a real interview? YesExampleGiven -21->10->4->5, tail connects to node index 1, return trueChallenge Follow up:Can ...
        阅读全文
            
摘要:Given a linked list, return the node where the cycle begins.If there is no cycle, return null.Have you met this question in a real interview? YesExampleGiven -21->10->4->5, tail connects to node index...
        阅读全文
            
摘要:Find the middle node of a linked list.ExampleGiven 1->2->3, return the node with value 2.Given 1->2, return the node with value 1.分析1 value 11->2 value11->2->3 value 21->2->3->4 value 21->2->3->4->5 v...
        阅读全文
            
摘要:Reverse a linked list from position m to n. NoticeGiven m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list.ExampleGiven 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL.来...
        阅读全文
            
摘要:Reverse a linked list.ExampleFor linked list 1->2->3, the reversed linked list is 3->2->1分析12345678910111213141516171819202122232425262728293031/** * Definition for ListNode. * public class ListNode {...
        阅读全文
            
摘要:As the title described, you should only use two stacks to implement a queue's actions.The queue should support push(element), pop() and top() where pop is pop the first(a.k.a front) element in the que...
        阅读全文
            
摘要:Implement a stack with min() function, which will return the smallest number in the stack.It should support push, pop and min operation all in O(1) cost. Noticemin operation will never be called if th...
        阅读全文
            
摘要:Write an efficient algorithm that searches for a value in an mx n matrix.This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each row is gr...
        阅读全文
            
摘要:Implement pow(x, n).分析该题目首先想到可以使用recursion去做,需要考虑一个陷阱,当 n 为 INT_MIN,反转会溢出1234567891011class Solution {public: double myPow(double x, int num) { long n = num; if(n == 0) return 1; ...
        阅读全文
            
摘要:Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"] ]Note: All 
        阅读全文
            
摘要:Given an unsorted array nums, reorder it in-place such that nums[0] = nums[2] & nums) { if(nums == NULL || nums.size() nums[i-1])) { swap(nums[i], nums[i - 1]); }...
        阅读全文
            
摘要:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index on Wikipedia: "A scie...
        阅读全文
            
摘要:Given a target number, a non-negative integer k and an integer array A sorted in ascending order, find the k closest numbers to target in A, sorted in ascending order by the difference between the num...
        阅读全文
            
摘要:Given a target number and an integer array A sorted in ascending order, find the index i in A such that A[i] is closest to the given target.Return -1 if there is no element in the array.分析使用binary Sea...
        阅读全文
            
摘要:For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity.If the target number does not exist in the array, return -1.来源: http://w...
        阅读全文
            
摘要:Find any position of a target number in a sorted array. Return -1 if target does not exist.与题目 First Position of Target 相同12345678910111213141516171819202122public class Solution { /** * @param...
        阅读全文
            
摘要:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as many times as it sho...
        阅读全文
            
摘要:Given an integer array, sort it in ascending order. Use quick sort, merge sort, heap sort or any O(nlogn) algorithm.分析Quick Sortindex 0 1 2 3 4 5 6 7 8 9 10 11 12 13A(key=3)4 1 2 1 5 1 3 2 3 6 2 1...
        阅读全文
            
摘要:Given an integer array, sort it in ascending order. Use selection sort, bubble sort, insertion sort or any O(n2) algorithm.分析bubble sort1234567891011121314151617181920public class Solution { /** ...
        阅读全文
            
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1...
        阅读全文
            
摘要:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The result can be in any ...
        阅读全文
            
摘要:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?来源: https://leetcode.com/problems/rotate-image/分析方法1:关键在于找到旋转90°的...
        阅读全文
            
摘要: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], [2,1,1] ] 来源: ...
        阅读全文
            
摘要: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,2,1] ]来源: htt...
        阅读全文
            
摘要:Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:The length of both num1 and num2 is =0; --i){ string tmp = multi(num1, num2[i]...
        阅读全文
            
摘要: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 combination.N...
        阅读全文
            
摘要:Given a set of candidate numbers (C) (without duplicates) 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...
        阅读全文
            
摘要: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, then o...
        阅读全文
            
摘要: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.Here...
        阅读全文
            
摘要: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 sudoku which...
        阅读全文
            
摘要:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.分析不能用除法,所以使用减法不断减 除数,同时对 除数 倍乘,进行加速除数:3 -> 6 -> 12 ...边界条件:1 除数为0,溢出2 被除数 INT_MIN,同时除数 -1,...
        阅读全文
            
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which ha...
        阅读全文
            
摘要:Given an array of integers sorted in ascending order, 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 i...
        阅读全文
            
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the a...
        阅读全文
            
 
                    
                 浙公网安备 33010602011771号
浙公网安备 33010602011771号