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 the character '.'.
A partially fille...
分类:
其他好文 时间:
2014-11-12 17:55:20
阅读次数:
189
一:写一个算法将栈里的元素升序排列。栈的实现未知,算法只能借助栈完成,可使用的函数有push、pop、top、empty等。思路:可借助另外一个栈来完成排序。1、从原始栈里依次弹出元素放入辅助栈;2、每当将要压入的元素是得辅助栈不是升序排列,就将辅助栈里面的元素重新压入原始栈中;3、直到辅助栈里面的...
分类:
编程语言 时间:
2014-11-12 16:12:31
阅读次数:
281
Length of Last WordGiven a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.I...
分类:
其他好文 时间:
2014-11-12 00:22:45
阅读次数:
215
function htmldecode($str) { if(empty($str)) return; if($str=="") return $str; $str=str_replace("&",chr(34),$str); $str=str_replace(">",">",$str...
分类:
其他好文 时间:
2014-11-11 20:40:50
阅读次数:
198
listview.setEmpty(View view);使用listView或者gridView时,当列表为空时,有时需要显示一个特殊的empty view来提示用户,今日对这个方法进行一下小结,书写的方式有三种:1.一般情况下,继承ListActivity,只要 当列表为空时就会自动显示Tex....
分类:
编程语言 时间:
2014-11-11 12:27:30
阅读次数:
272
PHP网站,我们经常会遇到按照汉字的首拼排序,如城市,如分类等,那么我们就需要把首字首拼转换为英文字母,下面的函数就可以帮我们实现:function getFristchar($str) { if(empty($str)){return '';} $fchar=ord($str{0});...
分类:
其他好文 时间:
2014-11-11 12:20:08
阅读次数:
152
不必解释了吧,这里代码应该就能说明问题了
#include
#include
#include
using namespace std;
//Queue
template
class Queue
{
public:
void pop(void);
void push(const T& t);
const T& front(void);
bool empty...
分类:
编程语言 时间:
2014-11-10 21:56:46
阅读次数:
391
一共用两个栈。一个用来放数据,另一个专门用来存放当前最小值。 1 class MinStack { 2 public: 3 void push(int x) { 4 elements.push(x); 5 if (mins.empty()||x element...
分类:
其他好文 时间:
2014-11-10 19:45:57
阅读次数:
143
就是用另外一个单调stack来记录最小值就可以了,这个队列单调递减。class MinStack {public: void push(int x) { st.push(x); if (stm.empty() || stm.top() >= x) stm.push(...
分类:
其他好文 时间:
2014-11-10 11:16:35
阅读次数:
157
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe...
分类:
其他好文 时间:
2014-11-10 06:30:52
阅读次数:
238