
算法
Young_Leez
这个作者很懒,什么都没留下…
展开
-
使用栈的迷宫算法java版
主要考察 栈 的使用主要思路如下: do { if(当前位置可通过) { 标记此位置已走过; 保存当前位置并入栈; if(当前位置为终点) { 程序结束; } 获取下一个位置; } else { if(栈非空) { 出栈;原创 2015-03-02 23:23:44 · 3172 阅读 · 1 评论 -
给定一个字符串,字符串中的*可以替换成0或1,输出所有可能的结果
给定一个字符串,字符串中的*可以替换成0或1,输出所有可能的结果例如,输入:abc*d*e输出abc0d0e abc0d1e abc1d0e abc1d1e用递归来做比较简单public class StrReplace { public static void main(String[] args) { StrReplace strReplace = new StrRepla原创 2015-03-02 19:45:35 · 1735 阅读 · 0 评论 -
[Leetcode]123.Best Time to Buy and Sell Stock III
问题描述: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. 思路:这道题目的标原创 2015-03-27 00:42:21 · 552 阅读 · 0 评论