自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

hellochenlu的博客

分布式系统/前端开发

  • 博客(45)
  • 资源 (1)
  • 问答 (10)
  • 收藏
  • 关注

原创 entity framework 添加唯一约束

当在字段前添加唯一约束时,会报如下错:EntityFramework: Column ‘COLUMN_NAME’ in table ‘dbo.TABLE_NAME’ is of a type that is invalid for use as a key column in an index[Index(IsUnique=true)]public string MacAddress

2016-03-29 09:14:54 5252

原创 ASP.NET使用EF时的seed方法以及初始数据的构造

待更

2016-03-25 16:19:32 6188

原创 ASP.NET MVC 5通过viewdata 向视图传递多个对象

在controller查询到的数据是:public ActionResult Index() { var products = GetTopSellingProducts(1); var genres = storeDB.Genres.ToList(); ViewData["IndexProducts"]

2016-03-25 11:20:57 3374

原创 一道JS 面试题

打印表头小明正在用JavaScript写一个日志分析程序。该程序会将日志转化为CSV文件,以便在Excel等应用中加载为一个表格。现在他在生成表头上遇到了困难。他需要实现如下一个方法:function printLine(array) { console.log(array.join(","));}function printHeader(obj) {

2016-03-23 10:26:22 410

原创 44 - Wildcard Matching(C)

Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t

2016-03-22 15:33:53 424

原创 43 - Multiply Strings

Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.Subscribe to see which companies

2016-03-22 14:29:04 299

原创 87 - Scramble String(DP)

Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr

2016-03-22 09:05:15 458

原创 五险一金

一、某职工每月可支配收入(以8000元为例) (1)个人缴费-社保与公积金缴费明细:养老8%:640元;医疗2%:163(160+3)元;失业0.2%:16元;住房公积金12%:960元。个税:应纳税额总计为2721元,缴纳个税:167.10元。个人缴费合计:1946.10元。(2)企业缴费-社保与公积金缴费明细:养老20%:1600元;医疗10%:800元;失业1%:80

2016-03-22 08:46:31 360

原创 87 - Scramble String(recursive)

Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr

2016-03-18 15:14:12 332

原创 一道阿里笔试题-javascript

不使用loop循环,创建一个长度为100的数组,并且每个元素的值等于它的下标?解法一:递归(function wallace (i) { return (i 解法二:Array的map方法Array(100).fill('naive').map(function (v, i) { return i; });思路分析:定义和用法concat() 方法用于连接两个或多

2016-03-18 13:29:44 480

原创 33 - Search in Rotated Sorted Array

Suppose a sorted array 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 array retur

2016-03-17 16:13:49 289

原创 76 - Minimum Window Substring

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN

2016-03-17 15:35:11 399

原创 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 fi

2016-03-17 14:51:13 252

原创 75 - Sort Colors

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

2016-03-16 10:39:08 302

原创 74 - Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2016-03-16 09:57:21 263

原创 176 - Second Highest Salary

Write a SQL query to get the second highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For exa

2016-03-15 15:09:02 613

原创 177 - Nth Highest Salary

Write a SQL query to get the nth highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For exampl

2016-03-15 14:46:58 406

原创 175 - Combine Two Tables

Table: Person+-------------+---------+| Column Name | Type |+-------------+---------+| PersonId | int || FirstName | varchar || LastName | varchar |+-------------+---------+Per

2016-03-15 14:24:20 312

原创 192 - Word Frequency

Write a bash script to calculate the frequency of each word in a text file words.txt.For simplicity sake, you may assume:words.txt contains only lowercase characters and space ' ' characters

2016-03-15 11:18:32 821

原创 193 - Valid Phone Numbers

Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers.You may assume that a valid phone number must appear

2016-03-15 10:19:01 773

原创 195 - Tenth Line

How would you print just the 10th line of a file?For example, assume that file.txt has the following content:Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Line 10Your script

2016-03-15 09:10:40 886

原创 110 - Balanced Binary Tree

Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2016-03-14 15:28:57 305

原创 109 - Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.Subscribe to see which companies asked this question思路分析:这题的关键是能找出当前链表的中间节点,然后再

2016-03-14 14:34:47 276

原创 108 - Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Subscribe to see which companies asked this question思路分析:递归。class Solution {public:

2016-03-14 14:09:34 251

原创 97 - Interleaving String

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", ret

2016-03-14 09:39:47 1225

原创 96 - Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \

2016-03-11 10:44:37 411

原创 94 - Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solutio

2016-03-11 09:30:09 381

原创 65 - Valid Number(DFA-Deterministic Finite Automaton)

Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo

2016-03-10 15:17:41 565

原创 206 - Reverse Linked List

Reverse a singly linked list.click to show more hints.Subscribe to see which companies asked this question思路分析:此题较容易。我们可以设置一个新的指针newHead。初始化为NULL。此时,迭代原始的链表。每一次把原始的链表的节点从头插入newHead

2016-03-10 10:44:35 287

原创 105 - 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.Subscribe to see which companies asked this questio

2016-03-09 15:55:55 317

原创 69 - Sqrt(x)

Implement int sqrt(int x).Compute and return the square root of x.Subscribe to see which companies asked this question思路分析:牛顿迭代法求解平方根。此时,令f(x) = x^2 - a, 此时迭代格式为:class Soluti

2016-03-09 11:22:48 437

原创 102 - Binary Tree Level Order Traversal(BFS)

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20

2016-03-08 16:11:21 263

原创 102 - Binary Tree Level Order Traversal(DFS)

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20

2016-03-08 15:27:29 289

原创 70 - Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Subscribe to see which c

2016-03-08 11:35:40 251

原创 68 - Text Justification

Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approach; that i

2016-03-08 09:52:34 642

原创 66 - Plus One

Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.Subscribe to see

2016-03-07 14:43:23 351

原创 58 - Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2016-03-07 14:20:44 293

原创 56 - Merge Intervals

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.E

2016-03-07 13:27:20 285

原创 53 - Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1]

2016-03-07 10:24:45 481

转载 Linux-find和grep命令

参考文档:http://blog.csdn.net/zhuyi2654715/article/details/7549213http://blog.csdn.net/wdzxl198/article/details/8929250grep功能说明:查找文件里符合条件的字符串。语  法:grep [-abcEFGhHilLnqrsvVwxy][-A

2016-03-05 20:02:23 1150

linux function

提供了linux环境下,c语言的API,各种函数的解释

2012-10-14

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除