diff --git a/02/Hint.md b/02/Hint.md new file mode 100644 index 0000000..4593804 --- /dev/null +++ b/02/Hint.md @@ -0,0 +1,3 @@ + + +It can be established that the rows that become 1 in the end are same in the beginning. So, keep a count of the frequency of every distinct row and since we have to perform exactly k operations, find the row with maximum frequency and (noOfZeros — k)%2 == 0. The answer is the frequency of that row. diff --git a/README.md b/README.md index 1a13ad7..4612468 100644 --- a/README.md +++ b/README.md @@ -548,4 +548,4 @@ Print the respective answer for T test cases in total for T lines. The answer is Men's restroom problem : It is a well-researched fact that men in a restroom generally prefer to maximize their distance from already occupied stalls, by occupying the middle of the longest sequence of unoccupied places. For detailed version, check the following link.
Link : https://stackoverflow.com/questions/32645046/urinal-algorithm-a-simple-optimization - + Hint : Use priority_queue to store distances