关闭

Linux-Ubuntu的三种权限

Ubuntu中的权限共有三类: 个人 组 其他个人 u:如果个人可以访问写入和执行某个文件,就说对这个文件有所有权。 组 g:如果某个人属于这个组,则这个人拥有这个组的权限 其他 o:不属于个人和组权限项: 读取 r 写入 w 执行 x 权限命令: chmod例子: chmod u+w ./a.sh 添加对脚本a的个人写入权限。...
阅读(106) 评论(0)

80. Remove Duplicates from Sorted Array II

题目可以重复一次的去重操作Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first...
阅读(265) 评论(0)

59. Spiral Matrix II

题目生成螺旋矩阵 Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example, Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ],...
阅读(328) 评论(0)

54. Spiral Matrix

螺旋式遍历矩阵 如下图所示的方法。 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example, Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7,...
阅读(414) 评论(0)

linux入门-shell(.sh)脚本编写和运行

编写第一个shell脚本在gedit中编写.sh格式的文件,保存为a.sh。 代码: #! /bin/bash # employ bash shell player1=xiaoming # define a player1 player2=ken echo "Game start! $player1 $player2" # echo is used to printf in termina...
阅读(222) 评论(0)

90. Subsets II

题目Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,2], a solution i...
阅读(2521) 评论(0)

78. Subsets

题目Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,3], a solution is:[ [3], [1], [2], [...
阅读(2435) 评论(0)

60. Permutation Sequence

题目求n个排序数的第k项 The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3):"123" "132" "213" "...
阅读(2485) 评论(0)

147. Sort a linked list using insertion sort

题目Sort a linked list using insertion sort.代码public ListNode InsertionSortList(ListNode head) { if (head == null) return null; //begining point of the sorted list, set a...
阅读(2442) 评论(0)

142. Linked List Cycle II

题目Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can you solve it without using extra space?代码/** * Defi...
阅读(305) 评论(0)

41. First Missing Positive

Find Missing Number 系列问题,灵活运用index,或异或在O(n)时间复杂度,O(1)空间复杂度解决问题。题目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. Y...
阅读(2340) 评论(0)

47. 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...
阅读(2378) 评论(0)

46. 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],...
阅读(181) 评论(0)

31. Next Permutation

求其下一个排序数的思路: 1. **逆序**搜索,找到第一个满足 $$nums[i-1]=1子序列的最小值。 最小值为 **4**;即交换 3 和 4,得到的序列为:**4** 5 **3** 2 1 3. 将i>=1的序列反转,即 4 **1 2 3 5**...
阅读(175) 评论(0)

64. 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 or right at an...
阅读(259) 评论(0)

63. Unique Paths II

上一个题目的完整解题思路: http://blog.csdn.net/daigualu/article/details/76018298Follow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle...
阅读(290) 评论(0)

62. Unique Paths

题目A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bot...
阅读(288) 评论(0)

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 combination....
阅读(585) 评论(0)

39. Combination Sum

题目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...
阅读(245) 评论(0)

25. Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of...
阅读(317) 评论(1)
37条 共2页1 2 下一页 尾页
    算法channel

    交流思想,注重分析,看重过程,包含但不限于:经典算法,机器学习,深度学习,LeetCode 题解,Kaggle 实战,英语沙龙,定期邀请专家发推。期待您的到来!

    算法与人工智能交流群:646901659

    个人资料
    • 访问:289700次
    • 积分:7168
    • 等级:
    • 排名:第3489名
    • 原创:339篇
    • 转载:0篇
    • 译文:0篇
    • 评论:55条