From 9029b6004e5b84651f1fa2544ba142803720ebfd Mon Sep 17 00:00:00 2001 From: Sahil Amin Date: Thu, 2 Dec 2021 17:07:42 +0530 Subject: [PATCH 1/2] Create Hint.md --- 02/Hint.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 02/Hint.md 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. From 6572e09f17f436c7df60f8962e1c6f249480eed9 Mon Sep 17 00:00:00 2001 From: Sahil Amin Date: Wed, 15 Dec 2021 14:47:19 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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