public class Main2 { public static void subSets(String s, String sb,int i){ if(i==s.length()) { System.out.println(sb); return; } subSets(s,sb+s.charAt(i),i+1); subSets(s,sb,i+1); } public static void main(String[] args){ String s="aef"; subSets(s,"",0); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter