@nitin
yes i meant the same, if each different character have equal number of
frequency like abcabcabc a's -3, b's - 3 c's- 3
then resultant string size is 2 else 1
surender
On Sun, Nov 13, 2011 at 12:21 AM, Ankur Garg wrote:
> @Srinivas
>
> Wat if the string is abc
> then it reduces to cc :)
google it.
*** thread closed
On Sun, Nov 13, 2011 at 9:36 AM, Aman Kumar wrote:
> Hiii
> if anybody has project on "Component Based Software Engineering" ,
> please reply on this thread asap
> thank you.
>
> --
> You received this message because you are subscribed to the
Gabung dengan Andi Dia di Yahoo! Messenger.
Ayo chat dengan saya, saling berbagi file dan banyak lagi.
Tetap terhubung dengan semua teman Anda.
Mulai :
http://invite.msg.yahoo.com/invite?op=accept&intl=id&sig=bwv8.66xZpAMXIG20ADHpekfzcPhlXCY2Y51LReEG.m1ifw-
* Selalu terhubung saat di rumah, di
Hiii
if anybody has project on "Component Based Software Engineering" ,
please reply on this thread asap
thank you.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscrib
@Srinivas
Wat if the string is abc
then it reduces to cc :) ...So size 2 can also be there.so u cant say it
will be 1 "always"
On Sun, Nov 13, 2011 at 12:01 AM, Srinivasa Chaitanya T <
tschaitanya@gmail.com> wrote:
>
>
> On Sat, Nov 12, 2011 at 4:24 PM, Snoopy Me wrote:
>
>> Given a string
On Sat, Nov 12, 2011 at 4:24 PM, Snoopy Me wrote:
> Given a string consisting of a,b and c's, we can perform the
> following
> operation:
> Take any two adjacent distinct characters and replace it with the
> third character. For example, if 'a' and 'c' are adjacent, they can
> replaced with 'b'.
Well it aint O(n) ..:P ...The erase part will be complex and will take
shifting string parts . So complexity will be O(n^2) for str.erase operation
On Sat, Nov 12, 2011 at 8:34 PM, Ankur Garg wrote:
> The Complexity of my solution is of Order n . At most I Traverse the whole
> string twice ..
The Complexity of my solution is of Order n . At most I Traverse the whole
string twice ..
On Sat, Nov 12, 2011 at 8:29 PM, vikas wrote:
> seems like quesion of permutation, it will take all the permutation to
> check which one can lead to answer, there will be always be more than
> one solutio
seems like quesion of permutation, it will take all the permutation to
check which one can lead to answer, there will be always be more than
one solution
complexity ((n-1)!)
anyone for better solution ??
On Nov 12, 4:27 pm, surender sanke wrote:
> @myself
>
> if number of distinct characters ar
Hey I coded it . The answer is either 2 or 1 ..So I guess you guys are rite
:)
Here is the code
void smallestString(string &str){
if(str.empty()) return;
int j=0,i,k=0;
for(i=1;i0)j--;
i=j;
}
}
}
On Sat, Nov 12, 2011 at 8:19 PM, Nitin Garg wrote:
> If yes, how d
If yes, how do you prove it?
On Sat, Nov 12, 2011 at 8:18 PM, Nitin Garg wrote:
> I can prove that the size of resulting string will be 1 or 2.
>
> @surender -
> what do you mean by no of distinct characters? they are 3 in this case -
> a,b and c.
> Do you mean to say that the no. of times each c
Did they ask you to code this or just asked logic
On Sat, Nov 12, 2011 at 4:57 PM, surender sanke wrote:
> @myself
>
> if number of distinct characters are equal then its final string size is 2.
> else there are more repeated characters other than distinct characters
> then its 1
>
> correct m
I can prove that the size of resulting string will be 1 or 2.
@surender -
what do you mean by no of distinct characters? they are 3 in this case -
a,b and c.
Do you mean to say that the no. of times each character appears are equal
then the final string is of size 2. and 1 otherwise?
On Sat,
Anyone has idea about
http://www.cs.helsinki.fi/group/boi2006/tasks/bitwise.pdf
Surely greedy works here: if we know we can set bit k in all the clauses,
then we set it regardless what happens for bits < k, this was as far as
I could get.
--
You received this message because you are subscribed
@myself
if number of distinct characters are equal then its final string size is 2.
else there are more repeated characters other than distinct characters then
its 1
correct me !!!
surender
On Sat, Nov 12, 2011 at 4:46 PM, surender sanke wrote:
> All distinct combinations will result in string
All distinct combinations will result in string size of 2 + rest repeated
characters
eg
abcabcabc ->aabbcc->abc->aa or bb or cc
surender
On Sat, Nov 12, 2011 at 4:24 PM, Snoopy Me wrote:
> Given a string consisting of a,b and c's, we can perform the
> following
> operation:
> Take any two adja
Given a string consisting of a,b and c's, we can perform the
following
operation:
Take any two adjacent distinct characters and replace it with the
third character. For example, if 'a' and 'c' are adjacent, they can
replaced with 'b'.
What is the smallest string which can result by applying this
o
Given a string consisting of a,b and c's, we can perform the following
operation:
Take any two adjacent distinct characters and replace it with the
third character. For example, if 'a' and 'c' are adjacent, they can
replaced with 'b'.
What is the smallest string which can result by applying this
18 matches
Mail list logo