题目问一个数字字符串的不重复全排列有几个能被d整除。 dp[S][m]表示用字符集合S构成的%d为m的数字字符串个数 dp[0][0]=0 我为人人转移,dp[S+{x}][(m*10+str[x]-'0')%d]+=dp[S][m](x?S) 最后的结果再除以各字符出现次数的阶乘就是答案了,即dp
分类:
其他好文 时间:
2016-02-01 23:57:41
阅读次数:
206
题目: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ B
分类:
其他好文 时间:
2016-01-29 16:05:13
阅读次数:
141
Using DFS to traverse the BST, when we look through the BST to a certain node, this node must have the following property to make sure the tree is a v
分类:
其他好文 时间:
2016-01-28 13:45:06
阅读次数:
152
基础题目 建一个堆栈,对于这个字符串,如果是左括号就放到堆栈里面,如果是右括号,就弹出堆栈里的一个元素,如果此时堆栈是空的,肯定是不匹配的,如果弹出的不匹配,也返回false。做完以后看堆栈是不是正好的空的,如果是空的就返回true,否则就是false。 1 public boolean isVal
分类:
其他好文 时间:
2016-01-28 09:24:42
阅读次数:
148
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2016-01-27 14:30:10
阅读次数:
212
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:
其他好文 时间:
2016-01-27 07:09:04
阅读次数:
178
1,SAE上申请服务器2,绑定测试账号3,Token验证responseMsg();}else{ $wechatObj->valid();}class wechatCallbackapiTest{ //验证消息 public function valid() { ...
分类:
微信 时间:
2016-01-26 12:20:39
阅读次数:
792
表单控件对象的validity对象可以设置或返回相关的验证信息(在invalid事件处理中获取validity对象):属性valid:为true所有验证通过,为False至少有一种验证失败。属性valueMissing:表单控件输入值为空时,该属性值为true;不为空时该属性值为false。属性ty...
分类:
Web程序 时间:
2016-01-24 16:56:17
阅读次数:
138
?package cn.edu.xidian.sselab.hashtable;import java.util.HashSet;import java.util.Set;/*** * @author zhiyong wang* title: Valid Sudoku* content:* Dete...
分类:
其他好文 时间:
2016-01-24 12:56:27
阅读次数:
129
yum[Errno256]Nomoremirrorstotry解决方法输入下面的命令即可解决问题:yum clean allyum makecache导致centos安装软件Error: Cannot find a valid baseurl for repo: base解决办法:echo "nam...
分类:
其他好文 时间:
2016-01-24 00:23:56
阅读次数:
162