{*1*,* 1*, 0, 0, 0},
{0, *1*, 0, 0, *1*},
{*1*, 0, 0, *1*, *1*},
{0, 0, 0, 0, 0},
{*1*, 0, *1*, 0, *1*}
above different set of color represent different island.Simple DFS is
got the islands...but first we scan each element then also dfs for them if
all are 1..then how it can be o(row*col)...plz explain me complexity ofr
this
On Fri, Apr 26, 2013 at 2:07 PM, atul anand atul.87fri...@gmail.com wrote:
{*1*,* 1*, 0, 0, 0},
an useful link
http://stackoverflow.com/questions/7338070/finding-an-element-in-an-array-where-every-element-is-repeated-odd-number-of-tim
On Fri, Apr 19, 2013 at 11:30 PM, kartik n kartik.car...@gmail.com wrote:
Hi Nishant i did not understand the code can u please describe a bit
Thanks
1. Make a trie of all dictionary words.
2.then run a loop for all characters of string
3.suppose start from I ,as I is a word in dictionary,word found then
increment counter
4.Now counter comes to X,no word found
5.Now it comes to A,two word could start from A(A and AM)
now run this loop till end
the code is simply utilizing the xor property as u know xor sets on odd one
so, if any array would have numbers odd times repeated
their bit will only stay in xor operation else will get nulify.
so in first loop bit of 1 and 3 are set, to seperate them we need to
divide them using any of their
@rahul : It's fine solution, but can we check the root-data == n1 || n2
before calling function recursively, I think if we check this condition 1st
it will reduce unnecessary function calls.
Correct me if i am wrong?
Thanks,
Tushar Patil.
On Sun, Apr 21, 2013 at 10:26 PM, rahul sharma