Auto commit
This commit is contained in:
parent
984e4b5848
commit
dae819bf03
@ -33,7 +33,19 @@ void removeDuplicates(char *str)
|
||||
if (len <= 1)
|
||||
return;
|
||||
/**********Program**********/
|
||||
|
||||
for(i=0;i<len-1;i++){
|
||||
for(writeIdx=i+1;writeIdx<len;writeIdx++){
|
||||
if(str[i] == str[writeIdx]){
|
||||
seen[writeIdx] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
writeIdx = 0;
|
||||
for(i=0;i<len;i++){
|
||||
if(seen[i]==0){
|
||||
str[writeIdx++] = str[i];
|
||||
}
|
||||
}
|
||||
/********** End **********/
|
||||
str[writeIdx] = '\0';
|
||||
}
|
||||
|
@ -22,7 +22,17 @@ void decimalToBinary(int decimal)
|
||||
return;
|
||||
}
|
||||
/**********Program**********/
|
||||
|
||||
for(i=0;decimal>0;i++,decimal/=2){
|
||||
binary[i] = decimal%2+48;
|
||||
}
|
||||
binary[i] = '\0';
|
||||
i--;
|
||||
for(;i>len;i--){
|
||||
remainder = binary[len];
|
||||
binary[len] = binary[i];
|
||||
binary[i] = remainder;
|
||||
len++;
|
||||
}
|
||||
/********** End **********/
|
||||
printf("%s\n", binary);
|
||||
}
|
||||
|
@ -17,7 +17,12 @@ int countPeaches(int lastDay)
|
||||
int peaches = 1;
|
||||
int day;
|
||||
/**********Program**********/
|
||||
|
||||
day = lastDay;
|
||||
while(day>1){
|
||||
peaches = (peaches+1)*2;
|
||||
day--;
|
||||
}
|
||||
return peaches;
|
||||
/********** End **********/
|
||||
}
|
||||
int main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user