书法字典:https://www.shufadict.com

2009年6月9日

Maximum subsequence sum

摘要: This is a very famous problem from programming pealsGiven an array of integers, return the maximum subsequence sum of the array, if the maximus sumless than 0, return 0Example1, 2, -6, 3, -2, 4, -1, 3... 阅读全文

posted @ 2009-06-09 17:08 翰墨小生 阅读(407) 评论(0) 推荐(0) 编辑

Consecutive sequence with sum 0

摘要: You are given an integer array which contains positive integers, zero and negetive integerscount how many consecutive sequences in this array make a sum of 0.exmapleint[] a = {4, -1, 2, 1, -2, -1, 5, ... 阅读全文

posted @ 2009-06-09 16:26 翰墨小生 阅读(388) 评论(0) 推荐(0) 编辑

2009年6月7日

Shortest distance between two arrays

摘要: Given two sorted array in non-descending order, each contains positive integersThe distance is define as followingpick up a number from each array, compute their differencereturn the shortest distance... 阅读全文

posted @ 2009-06-07 16:07 翰墨小生 阅读(379) 评论(0) 推荐(0) 编辑

2009年6月6日

Plateau problem

摘要: Given a sorted array in non-descending order, the element type can be positive integer or char, return the length of the longest consecutive segmentsExample, Input:"1223334556", output 3Input: "abccde... 阅读全文

posted @ 2009-06-06 12:50 翰墨小生 阅读(523) 评论(0) 推荐(0) 编辑

2009年6月5日

DP_LCS

摘要: The Longest Common Subsequence problemGive two strings a and b. return the length of the longest common subsequence of them.Note: characters in subsequence needn’t to be consecutive, but in subs... 阅读全文

posted @ 2009-06-05 12:01 翰墨小生 阅读(553) 评论(1) 推荐(0) 编辑

2009年6月4日

一维数组和二维数组的转换表示(C#)

摘要: 关键:下标的计算一维->二维一个n个元素的一维数组,转换为r行c列的二维数组对于一维数组中任意一个元素的下标i(0 <= i < n)其对应的二维数组下标为 (i / c, i % c), 显然, 只与列数c有关,而与行数r无关code like this[代码]also can write like this[代码]二维->一维[代码] 阅读全文

posted @ 2009-06-04 15:00 翰墨小生 阅读(23737) 评论(1) 推荐(2) 编辑

2009年6月3日

BackTracking_Fixed sum for array elements

摘要: Given an array a contains distinct positive integers, count how many combinations of integers in a add up to exactly sumFor example, given int[] a = {... 阅读全文

posted @ 2009-06-03 16:36 翰墨小生 阅读(442) 评论(0) 推荐(0) 编辑

BSP 面试总结

摘要: 指针参数 当指针作为函数参数时,对参数本身的修改并不影响原来的值,比如下面的代码,删除链表中第一个值为item的结点。但是结果却不正确。 void Delete(Node *head, int item){ if(head->value == item) head = NULL ;} 这段代码的问题 阅读全文

posted @ 2009-06-03 14:00 翰墨小生 阅读(2451) 评论(5) 推荐(0) 编辑

2009年5月26日

回溯法解符号三角形

摘要: 消化一个算法最重要的是理解他的思想,而不是急于搞定代码,写文章重要的是阐明道理,而不是简单的粘贴代码,这篇文章需要详细的分析!符号三角形问题是经典的回溯问题,下图是一个符号三角形+ + - ++ - - - + -这个三角形的组成规则是,只能由+和-组成,并且两个相同符号的下面是+,两个不同符号下面是-,设符号三角形第一行有n个符号,对于给定的n,计算有多少种不同的符号三角形,使得+和-的个数相等。例如,当n=4时,共有如下六种符号三角形满足条件+ + - ++ - - - + -+ + - -+ - + - - ++ - + +- - + + - -+ - + -- - - + + +- + 阅读全文

posted @ 2009-05-26 09:30 翰墨小生 阅读(1637) 评论(2) 推荐(0) 编辑

2009年5月7日

切莫开一块地荒一块地

摘要: 做技术要专注 阅读全文

posted @ 2009-05-07 22:59 翰墨小生 阅读(466) 评论(0) 推荐(0) 编辑

导航

书法字典:https://www.shufadict.com