美文网首页
subset子集

subset子集

作者: JaJIng | 来源:发表于2019-04-03 16:17 被阅读0次
    subset.PNG
    public class Subset {
        public static void main(String[] args) {
            set("","abc");
        }
        
        public static void set(String left, String right) {
            if(right == null || right.equals("")) {
                System.out.println(left);
                return;
            }
            
            //选
            set(left+right.substring(0,1),right.substring(1));
            //不选
            set(left,right.substring(1));
            
        }
    
    }
    

    相关文章

      网友评论

          本文标题:subset子集

          本文链接:https://www.haomeiwen.com/subject/mconbqtx.html