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-...
分类:
其他好文 时间:
2014-07-07 16:17:00
阅读次数:
139
1.当希望方法返回多个值时,声明out方法很有用。这样使方法可以有选择地返回值。using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 求数组最大最小值{ class...
分类:
其他好文 时间:
2014-07-07 14:53:45
阅读次数:
190
Given a set of distinct integers, S, return all possible subsets.
分类:
其他好文 时间:
2014-07-07 14:31:24
阅读次数:
164
1 public IQueryable LoadPageuserInfos(int pageSize, int pageIndex, out int total, 2 Func wherelambda, Func orderbyLambda, bool isasc) 3 ...
分类:
其他好文 时间:
2014-07-07 14:13:08
阅读次数:
188
linq对数据的查询方式的表达形式主要有两种:var demo =from p in pList where p.id=*** select p;var demo =pList.where(p=>p.id=***) select p;以上是linq最近常见的两种表达形式。linq支持多种操...
分类:
其他好文 时间:
2014-07-03 11:57:38
阅读次数:
280
在上一篇我们在宏观概要上对DAL层进行了封装与抽象。我们的目的主要有两个:第一,解除BLL层对DAL层的依赖,这一点我们通过定义接口做到了;第二,使我们的DAL层能够支持一切数据访问技术,如Ado.net,EF,linq To Sql,这一点我们实现的不是很完美,仍有很大的改进空间,本文将加以改进。...
分类:
其他好文 时间:
2014-06-30 13:46:37
阅读次数:
324
上次我们说到了linq对数组内容的检索,自.net2.0以后,泛型成了很常见的一种应用技术,linq对泛型的检索也提供了完善的支持如对list类型的支持,范例如下: class Program { static void Main(string[] args) { List samplebooks ...
分类:
其他好文 时间:
2014-06-30 11:30:12
阅读次数:
125
题目
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-30 09:36:18
阅读次数:
192
题目
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
方法
和上题方法一样,使用回溯法,结构基本相同,只需要返回数量。
public i...
分类:
其他好文 时间:
2014-06-30 06:24:22
阅读次数:
273
题目
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-30 00:34:18
阅读次数:
188