Leetcode Biweekly Contest 35
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-35
This time, I only managed to solve the first easy puzzle in 5 minutes - but failed to solve the remaining three.
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.
Sum of All Odd Length Subarrays
Easy: Too Loops - skip the even subarray
Solution: Algorithm to Sum of All Odd Length Subarrays
Maximum Sum Obtained of Any Permutation
Medium: Count the frequency of ranges, then sort the numebrs and ranges from large to small, multiply each part.
Make Sum Divisible by P
Medium: Prefix sum, check the prefixSum modulous P.
Strange Printer II
Every little helps! I hope this helps!
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