- 博客(98)
- 收藏
- 关注
原创 在群晖NAS(DSM 7)使用 Nginx 安装 HTTP Git 服务器
【代码】群晖NAS(DSM 7)下配置nginx开发git http访问。
2023-06-28 09:58:43
2351
原创 回溯实现八皇后问题
同学吹牛说5分钟能写出八皇后问题实现,要打赌100块钱。我说200块钱半个小时,不算在纸上思考的时间。我也挺感兴趣,就一起写。他二十分钟就写出了(思路正确且简洁,就是后来发现答案不对),我大体思路对,但有点绕晕了。后来回家又重新写了一遍,花了半小时。天赋有限啊!import java.util.Arrays;/** * 回溯实现八皇后问题 * Created by
2017-03-25 10:28:05
469
原创 MySQL字符集问题
遇到了这么个问题,数据库表的字符集是utf8,但客户端程序在建立连接时设置了:set names latin1。 查询数据库中的中文字符“尊”的列,返回的是”尚“。 “尊”和“尚”被错误的认为是相等的。要解释上边的怪现象需要先明确以下几个概念:MySQL Charset(字符集)MySQL Collate(校对集)character_set_clientcharacter_set_co
2015-09-06 18:23:27
694
原创 Java实现生产者,消费者问题
高手给布置的任务。多线程最开始学Java的时候学的,今天写得很顺,自己都觉得挺吃惊。还得查查资料,看这么写是不是最优的。package com.weishubin.thread;//生产者public class Producer implements Runnable { private ProductionStore store; public Producer
2015-03-01 22:29:20
568
原创 SpringMVC中的参数组装:HandlerMethodArgumentResolver
SpringMVC中参数组装:HandlerMethodArgumentResolverSpringMVC3.1引入了HandlerMethodArgumentResolver接口,Spring调用该接口实现Controller的参数装配。HandlerMethodArgumentResolver实现中会调用DataBinder,Converter等。常用的该接口实现类有:Servle
2015-02-23 22:14:50
15035
1
原创 [读书笔记] Spring MVC中的参数绑定
Spring通过ConversionService接口将请求参数转换为Controller方法中的参数。对具体的类型转换,Spring定义了三个接口:Converter,GenericConverter,ConverterFactory。Spring还定义了ConverterRegistry接口用于在ConversionService的实现类中添加和移除Converter。接口Conf
2015-02-20 11:45:57
1542
原创 [读书笔记]CSS绝对定位
设置CSS的绝对定位:{ position : absolute; top : 7px; right : 0 }此时元素会相对于body元素。可将其父元素定位设置为relative使该元素相对于父元素绝对定位。{ position : relative; }
2015-01-02 23:17:34
546
原创 [读书笔记]清除Float的方法
因为设置了float,元素的高度被忽略了,其下方元素会紧贴上来,可以使用如下两个方法避免。为元素样式设置:overflow:hidden为元素添加clearfix样式:.clearfix:before, .clearfix:after { content: ""; display: table; }.clearfix:after { clear: both; }.c
2015-01-02 13:07:17
651
原创 LeetCode:Intersection of Two Linked Lists
我的方案时间复杂度O(N+M),空间复杂度O(1):第一遍遍历两个列表,得到列表headA和headB的元素个数N,M,假设N>M。然后headA从第N-M个元素开始遍历,headB从第一个元素开始遍历,遇到相等的元素返回。如果遍历到末尾都不相等,返回NULL。与标准答案的复杂度是一样的,我的方法更好理解些。public class Solution { pu
2014-11-28 23:09:59
1286
原创 LeetCode:Subsets
Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain dupli
2013-10-16 17:49:43
1068
原创 LeetCode:Subsets
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,
2013-10-16 17:25:13
1289
原创 LeetCode: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.
2013-10-16 14:53:55
628
原创 LeetCode: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].是道搜索题,这种类
2013-10-15 19:24:15
1451
原创 LeetCode:Rotate Image
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?坐标转换public void rotate(int[][] matrix) { if
2013-10-15 16:17:48
735
原创 LeetCode:Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]
2013-10-11 16:37:40
642
原创 LeetCode:Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.以前在某ACM网站做过这个题,没用递归,差点死了。这题用递归实现很简单。pub
2013-10-10 14:02:59
1089
原创 LeetCode:Word Break II
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens = "
2013-10-10 11:32:55
3281
原创 LeetCode:Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2013-10-08 13:38:40
2276
原创 LeetCode: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.我没想出来合适的算法,看了微信公众账号待字闺中的
2013-10-08 11:22:26
2469
原创 LeetCode: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 and without an
2013-10-04 11:01:25
885
原创 LeetCode: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 at least on
2013-10-02 16:59:27
2382
原创 LeetCode: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 from 0 to N - 1, where N is the total nodes
2013-09-30 12:25:42
2786
原创 LeetCode: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 station i to
2013-09-30 12:19:21
7539
原创 LeetCode:Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1-
2013-09-16 11:01:41
841
原创 LeetCode:Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each
2013-09-15 22:32:42
2146
原创 LeetCode:Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2013-09-15 21:52:55
1158
原创 LeetCode:Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically
2013-09-03 16:35:15
902
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人