上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 30 下一页
摘要: 题目描述:在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数。输入:每个测试案例包括两行:第一行包含一个整数n,表示数组中的元素个数。其中1 v[right]时,cnt += 所有左边的left以后的元素的个数,而不是cnt ... 阅读全文
posted @ 2014-04-18 15:19 Eason Liu 阅读(345) 评论(0) 推荐(0) 编辑
摘要: Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.跟上一题一样,改下结果的显示方式。 1 class S... 阅读全文
posted @ 2014-04-18 00:32 Eason Liu 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
posted @ 2014-04-17 18:56 Eason Liu 阅读(409) 评论(0) 推荐(0) 编辑
摘要: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2014-04-17 17:22 Eason Liu 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2014-04-14 00:13 Eason Liu 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2014-04-13 23:52 Eason Liu 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文
posted @ 2014-04-13 22:25 Eason Liu 阅读(1418) 评论(0) 推荐(0) 编辑
摘要: Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ... 阅读全文
posted @ 2014-04-13 20:22 Eason Liu 阅读(894) 评论(0) 推荐(0) 编辑
摘要: Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The function prototype should be:bool isMatch(const char 阅读全文
posted @ 2014-04-13 14:44 Eason Liu 阅读(2385) 评论(0) 推荐(0) 编辑
摘要: Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) Insert a characterb) Delete a characterc) Replace a character自然语言处理(NLP)中,有一个基本问题就是求两个字符串的minimal Edit Dist 阅读全文
posted @ 2014-04-12 22:56 Eason Liu 阅读(3009) 评论(3) 推荐(1) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 30 下一页