- 博客(62)
- 收藏
- 关注
原创 [LeetCode] 410. Split Array Largest Sum
题目链接: https://leetcode.com/problems/split-array-largest-sum/description/DescriptionGiven an array which consists of non-negative integers and an integer m, you can split the array into m non-em
2018-01-08 12:08:45
809
原创 [LeetCode] 621. Task Scheduler
题目链接: https://leetcode.com/problems/task-scheduler/description/DescriptionGiven a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters repres
2018-01-07 11:07:41
898
原创 [算法概论习题] 证明 EXACT 4SAT 是 NP-complete 问题
8.8. In the EXACT 4 SAT problem, the input is a set of clauses, each of which is a disjunction of exactly four literals, and such that each variable occurs at most once in each clause. The goal is to f
2017-12-31 14:39:51
1227
原创 [LeetCode] 25. Reverse Nodes in k-Group
题目链接: https://leetcode.com/problems/reverse-nodes-in-k-group/description/DescriptionGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive int
2017-12-27 11:11:18
406
原创 [LeetCode] 75. Sort Colors
题目链接: https://leetcode.com/problems/sort-colors/description/DescriptionGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colo
2017-12-23 09:09:37
333
原创 [LeetCode] 474. Ones and Zeroes
题目链接: https://leetcode.com/problems/ones-and-zeroes/description/DescriptionIn the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now,
2017-12-16 09:16:26
554
原创 [LeetCode] 310. Minimum Height Trees
题目链接: https://leetcode.com/problems/minimum-height-trees/description/DescriptionFor a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted
2017-12-14 10:42:23
891
原创 [LeetCode] 581. Shortest Unsorted Continuous Subarray
题目链接: https://leetcode.com/problems/shortest-unsorted-continuous-subarray/description/DescriptionGiven an integer array, you need to find one continuous subarray that if you only sort this subarray in
2017-12-08 09:31:32
310
原创 [LeetCode] 103. Binary Tree Zigzag Level Order Traversal
题目链接: https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/description/DescriptionGiven a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to
2017-12-07 14:14:07
433
原创 [LeetCode] 540. Single Element in a Sorted Array
题目链接: https://leetcode.com/problems/single-element-in-a-sorted-array/description/DescriptionGiven a sorted array consisting of only integers where every element appears twice except for one element wh
2017-12-04 15:17:21
527
原创 [LeetCode] 337. House Robber III
题目链接: https://leetcode.com/problems/house-robber-iii/description/DescriptionThe thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.”
2017-11-29 10:56:29
731
原创 [Ubuntu] 修改键位 — ctrl 和 caps lock 互换
环境Ubuntu 16.04步骤$ sudo vim /usr/share/X11/xkb/keycodes/evdev搜索 <CAPS> 和 <LCTL>,交换等号后面的数字 ... <CAPS> = 37; ... <LCTL> = 66;注销,重新登录以生效。
2017-11-28 00:36:58
5386
原创 [LeetCode] 503. Next Greater Element II
题目链接: https://leetcode.com/problems/next-greater-element-ii/description/DescriptionGiven a circular array (the next element of the last element is the first element of the array), print the Next Great
2017-11-27 23:52:34
354
原创 [LeetCode] 496. Next Greater Element I
题目链接: https://leetcode.com/problems/next-greater-element-i/description/DescriptionYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the
2017-11-26 11:01:23
396
原创 [LeetCode] 207. Course Schedule
题目链接: https://leetcode.com/problems/course-schedule/description/DescriptionThere are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to
2017-11-24 10:40:35
328
原创 [LeetCode] 3. Longest Substring Without Repeating Characters
题目链接: https://leetcode.com/problems/longest-substring-without-repeating-characters/description/DescriptionGiven a string, find the length of the longest substring without repeating characters.Examples
2017-11-20 00:17:59
365
原创 [LeetCode] 475. Heaters
题目链接: https://leetcode.com/problems/heaters/description/DescriptionWinter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now,
2017-11-19 23:23:19
646
原创 [LeetCode] 57. Insert Interval
题目链接: https://leetcode.com/problems/insert-interval/description/DescriptionGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that t
2017-11-12 21:00:31
523
原创 [LeetCode] 34. Search for a Range
题目链接: https://leetcode.com/problems/search-for-a-range/description/DescriptionGiven an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your a
2017-11-12 20:21:41
363
原创 [TensorFlow] Ubuntu 16.04 配置 tensorflow gpu 环境
参考内容 http://blog.youkuaiyun.com/u012759136/article/details/53355781 http://blog.youkuaiyun.com/zafir_410/article/details/73188228 https://devtalk.nvidia.com/default/topic/996474/linux/unable-to-load-the-n
2017-11-03 18:38:11
4073
原创 [LeetCode] 442. Find All Duplicates in an Array
题目链接: https://leetcode.com/problems/find-all-duplicates-in-an-array/description/DescriptionGiven an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear on
2017-11-01 20:22:16
322
原创 [LeetCode] 32. Longest Valid Parentheses
题目链接: https://leetcode.com/problems/longest-valid-parentheses/description/DescriptionGiven a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) paren
2017-11-01 19:37:17
303
原创 [LeetCode] 467. Unique Substrings in Wraparound String
题目链接: https://leetcode.com/problems/unique-substrings-in-wraparound-string/description/DescriptionConsider the string s to be the infinite wraparound string of “abcdefghijklmnopqrstuvwxyz”, so s will
2017-10-27 18:02:49
364
原创 [LeetCode] 41. First Missing Positive
题目链接: https://leetcode.com/problems/first-missing-positive/description/DescriptionGiven an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3
2017-10-23 22:42:44
379
原创 [LeetCode] 4. Median of Two Sorted Arrays
题目链接: https://leetcode.com/problems/median-of-two-sorted-arrays/description/DescriptionThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays
2017-10-20 23:19:34
315
转载 什么是P问题、NP问题和NPC问题
转载自:http://www.matrix67.com/blog/archives/105 这或许是众多OIer最大的误区之一。 你会经常看到网上出现“这怎么做,这不是NP问题吗”、“这个只有搜了,这已经被证明是NP问题了”之类的话。你要知道,大多数人此时所说的NP问题其实都是指的NPC问题。他们没有搞清楚NP问题和NPC问题的概念。NP问题
2017-10-19 14:58:19
977
原创 [C++] MD5加密算法原理及实现
参考文献: 1. RFC1321 - R. Rivest 2. 中山大学 蔡国扬 老师的 Web安全课件算法概述MD5 使用 little-endian,输入任意不定长度信息,以 512 位长进行分组,生成四个32位数据,最后联合起来输出固定 128 位长的信息摘要。MD5 算法的基本过程为:求余、取余、调整长度、与链接变量进行循环运算、得出结果。在 RFC1321 中,算法共分
2017-10-16 17:20:20
3222
原创 [LeetCode] 650. 2 Keys Keyboard
题目链接: https://leetcode.com/problems/2-keys-keyboard/description/DescriptionInitially on a notepad only one character ‘A’ is present. You can perform two operations on this notepad for each step:Copy
2017-10-14 20:08:07
493
原创 [LeetCode] 658. Find K Closest Elements
题目链接: https://leetcode.com/problems/find-k-closest-elements/description/DescriptionGiven a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be
2017-10-03 20:34:44
1510
原创 [LeetCode] 547. Friend Circles
题目链接: https://leetcode.com/problems/friend-circles/description/DescriptionThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For e
2017-09-25 22:43:01
581
原创 [LeetCode] 673. Number of Longest Increasing Subsequence
题目链接: https://leetcode.com/problems/number-of-longest-increasing-subsequence/description/DescriptionGiven an unsorted array of integers, find the number of longest increasing subsequence.Example 1:Inp
2017-09-23 09:32:44
986
原创 [LeetCode] 134. Gas Station
题目链接: https://leetcode.com/problems/gas-station/description/DescriptionThere 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
2017-09-20 00:10:50
460
原创 [LeetCode] 556. Next Greater Element III
题目链接: https://leetcode.com/problems/next-greater-element-iii/description/DescriptionGiven a positive 32-bit integer n, you need to find the smallest 32-bit integer which has exactly the same digits ex
2017-09-14 00:17:06
563
原创 [LeetCode] 135. Candy
题目链接: https://leetcode.com/problems/subsets/DescriptionThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the followin
2017-09-09 16:00:46
474
原创 [LeetCode] 145. Binary Tree Postorder Traversal
[LeetCode] 145. Binary Tree Postorder Traversal 题目链接: https://leetcode.com/problems/binary-tree-postorder-traversal/description/DescriptionGiven a binary tree, return the postorder traversal of its
2017-09-06 21:18:50
354
原创 [C++日常小题] 计算二叉查找树的高度
Description给定一个二叉查找树,要求计算其高度,每个二叉查找树将给出先序与中序的遍历。例如:一个二叉查找树其先序遍历为:16, 10, 4, 15, 23 ; 中序遍历为 4, 10, 15, 16, 23,则其高度为2(假定空树高度为-1,只有根节点的数高度为0)Input第一行输入测试用例个数。对于每个测试用例,第一行是节点个数n,第二行是key值的先序遍历,第三行是key值的中序遍历
2017-01-01 10:42:44
3723
原创 [NodeJs] Express + Mongodb + Materialize 搭建多人博客
一个用 Express、MongoDB、Materialize 搭建的小型博客。由于本人也只是基本学了下这些框架,第一次写个小型博客来练练手,功能还未完全实现,会持续更新。 另外,可能还有些小细节没有注意到,如果有发现哪里有 bug 或者好的建议,请不吝指出,谢谢。 在线预览: http://118.89.16.142/环境Node: v7.0.0Express: 4.xMongoDB
2016-12-22 00:34:28
1239
原创 [Web] 简易Markdown可预览编辑器 —— Codemirror+Marked+Prism
代码很简单,都是在用别人写好的东西,觉得这个还是有点用,所以简单记录一下。 在线预览: http://118.89.16.142:8000/csdndemo/markdown插件文本编辑: CodemirrorMarkdown解析: MarkedMarkdown Css: Github-markdown-css代码高亮: prismjs效果预览代码除了插件那些的js和css文件,就只
2016-12-16 17:01:40
7140
原创 [LeetCode] 78. Subsets
题目链接: https://leetcode.com/problems/subsets/DescriptionGiven a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nu
2016-12-15 17:12:46
520
原创 [LeetCode] 22. Generate Parentheses
题目链接: https://leetcode.com/problems/generate-parentheses/DescriptionGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a s
2016-12-15 16:02:54
460
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人