Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 02/Hint.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. <br>
Link : https://stackoverflow.com/questions/32645046/urinal-algorithm-a-simple-optimization


<b> Hint : Use priority_queue to store distances </b>