Now that the Global Challenge has ended. Can anyone share his/her idea for 9th problem. I could score 80, failing in 10 test cases.

Also feel free to share your ideas for other problems.

I did not completely understood 9th question, but from what i understood, i calculated sum of rows and sum of columns, and if all values are equal, then possible else impossible. score- 90/90

Did the same. full score.

much more importantly, anyone who got 90/90 in q4 please share your code.

What is the logic? Weren’t we required to swap values on different columns and make atleast one cell of the row 0?

How to solve 2nd question of medium (Perfect Matching)?

Its greedy. for every row sum, we need a subset of columns whose sum adds up to that row-sum. If all the row sums equal all the column sums, it will be possible for the whole table because there is no limit on the amount of swaps you can make.

Every person has two properties: how many people he needs and how many people want him in a meeting. You just need to find the max of the summation of these two properties. However if x needs y and y needs x then only one meeting is needed instead of two. This is the only corner case you need to care about. Rest its simple implementation.

Makes sense. Thanks

1.)calculate the no of sessions between the bankers and participants .

2.)while calculating the no of sessions consider both bankers and participants preferences . ( u can use a array of set to store in order to avoid duplicates)

3.) the one with maximuim size of the set is the required answer.

if you want the code follow this link ->

Can someone please explain the logic of 7th question please , does it accept n^2 solution because n was 10000 .

For first question from medium, I tried a lot ,but 9 test cases were not passed.Anyone here faced same problem?Can anyone help to guess which could be those cases?

Yup same. I got 86. Couldn’t figure out why my solution was wrong

Could someone help with the 7th question?

My idea was- Consider individual parent nodes given and their connected nodes and put them in a adjacency list. If any of the nodes have parents and children same, I found the maximum connected component out of them. This approach gave me 88 and 2 TLE.

Could you please share your code? I was following kind of a similar approach but did not work.

I am not able to access my code through github as well as the contest page. Will write and share it tomorrow.

Thanks a lot!

@shubho7470 treat it as a graph, if 1 and 2 answer 3’s question then there is a directed edge from 1 and 2 to 3. now first condition can be found by traversing for all nodes and checking if it has an edge to a node that already points to it. for second condition i put all suspicious nodes in a queue and had a vector v for all nodes with 0 values initially. now if a suspicious node A points to a non-suspicious node B, then v[B] += 1. if v[B] >1 then add it to the queue. keep doing this till queue is empty. got 90/90.

The 9th question could be made more difficult by not stating each bank should have simillar kind of transactions. for eg type 0 bank can also have other then type 0 transaction. But each bank should only have one kind of transaction.