Leetcode Biweekly Contest 36
I have recently started to attend the online coding contest. Leetcode has held weekly contests on Sunday early mornings - which isn't ideal for coders living in Europe.
However, they have biweekly contests, which is run the Sat 3:30 to 5:30 (BST) every two weeks.
Today's contest: https://leetcode.com/contest/biweekly-contest-36
Today's contest difficulty - considered to be medium. I have solved 3 out of 4 - the last one Time Limited Exceeded.
The programming language I choose is C++. I have quite many wrong answers or Time Limit Exceeded - which adds a lot of time penalization to the final result.
Design Parking System
https://leetcode.com/contest/biweekly-contest-36/problems/design-parking-system
Easy: three counters. It is super easy because you can only park CarType at its type - for instance, you cannot park small car in the big car slot.
Alert Using Same Key-Card Three or More Times in a One Hour Period
https://leetcode.com/contest/biweekly-contest-36/problems/alert-using-same-key-card-three-or-more-times-in-a-one-hour-period
Medium: The difficulty is that you need O(nLogN) to check if given 60 minutes there are more than 3 entries. You can do this easiy using O(NlogN) because the number of the entries group by names (using hash map) is small.
Find Valid Matrix Given Row and Column Sums
https://leetcode.com/contest/biweekly-contest-36/problems/find-valid-matrix-given-row-and-column-sums
Medium: Greedy - put as many as you can given the contraints and update the counter.
See Greedy Algorithm to Find Valid Matrix Given Row and Column Sums
Find Servers That Handled Most Number of Requests
https://leetcode.com/contest/biweekly-contest-36/problems/find-servers-that-handled-most-number-of-requests
Difficulty - Turn circular into linear by appending a copy to itself.
Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com
Steem On!~
Every little helps! I hope this helps!
- Computing & Technology
- Download Youtube Video
- Find Cheap & Bargin VPS: VPS Database
- Online Software and Tools
If you like my work, please consider voting for me or Buy Me a Coffee, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy
拍拍
拍拍
拍拍拍