剑指offer 28. 字符串的全排列
来源:互联网 发布:美工是什么岗位 编辑:程序博客网 时间:2024/06/05 16:57
//题目:输入一个字符串,输出字符串的全排列//解法:确定字符串的第一个字符,然后递归求之后字符的全排列public class Main {public static void main(String[] args) throws Exception {printAllSeq("abc");}public static void printAllSeq(String str){if(str == null){return;}char[] input = str.toCharArray();printAllSeqHelper(input,0);}public static void printAllSeqHelper(char[] input, int begin){if(begin == input.length-1){System.out.println(input);}else{for(int i = begin;i<input.length;i++){char temp = input[begin];input[begin] = input[i];input[i] = temp;printAllSeqHelper(input,begin+1);temp = input[begin];input[begin] = input[i];input[i] = temp;}}}}
0 0
- 剑指offer 28. 字符串的全排列
- 剑指Offer------字符串的排列(全排列)
- 剑指offer:字符串的全排列
- 剑指offer:字符串的排列(字符串全排列)
- 剑指offer 之 字符串的全排列、全组合
- 《剑指offer》:[28]字符串的全排列问题
- 剑指offer----字符串的全排列----java实现
- 【面试题】剑指Offer-28-字符串的全排列
- 剑指offer面试题28 字符串的全排列
- 剑指offer 28字符串全排列
- 码农小汪-剑指Offer之25 -字符串的排列(全排列)
- 【剑指offer】字符串的排列
- 剑指offer--字符串的排列
- 《剑指offer》字符串的排列
- 【剑指Offer】字符串的排列
- 剑指offer--字符串的排列
- 剑指offer:字符串的排列
- 剑指offer:字符串的排列
- Android Design之TableLayout选项卡
- 求100到200之间的素数
- (译)神经网络基础(2):Softmax 分类函数
- 【java】intellij idea SpringMVC 配置FreeMarker模板引擎
- 能让我学到东西的博客及网站
- 剑指offer 28. 字符串的全排列
- 利用intellij idea创建maven 多模块项目
- CS231n课程笔记翻译:卷积神经网络笔记
- stompest库的应用实例
- Linux下Redis的安装和部署
- linux字符集
- android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@4
- 考察数据科学家数据降维知识的40道题,快来测测吧
- web前端注册基础标准版(拥有提示和过滤功能)