“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
/**
* How do I write a program to print proper subset of given string . Eg :input: abc
* output:{},{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}
*/
public void subset(String input){
char[] chars = input.toCharArray();
int i =0;
int j = 0;
int lead = 1;
while(lead
Does the string have duplicates? i.e. input string = aabccc
answerset will contain all the answers.
function createSubset(List set, List answerset)
foreach( element e in set )
subset = remove(e, set)
push(subset, answerset)
createSubset(subset)
main:
input: List set
List answerset = {}
createSubset(set, answerset)
sort(answerset)
remove-duplicates(answerset)
print(answerset)
/**
* How do I write a program to print proper subset of given string . Eg :input: abc
* output:{},{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}
*/
public void subset(String input){
char[] chars = input.toCharArray();
int i =0;
int j = 0;
int lead = 1;
while(lead
let abc = 111
list 000 to 111
replace 1 with corresponding character
use recursive call
below is my answer:
#include “stdafx.h”
#include
void getsub(char arr[], char* const ret,int count,int n)
{
if(n==1)
{
for(int i=0;i
Leave an Answer/Comment