Leetcode Biweekly Contest 35

in #whereinlast month

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

https://leetcode.com/contest/biweekly-contest-35/problems/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

https://leetcode.com/contest/biweekly-contest-35/problems/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

https://leetcode.com/contest/biweekly-contest-35/problems/make-sum-divisible-by-p
Medium: Prefix sum, check the prefixSum modulous P.

Strange Printer II

https://leetcode.com/contest/biweekly-contest-35/problems/strange-printer-ii
Difficulty - DFS?


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!


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

Coin Marketplace

STEEM 0.15
TRX 0.03
JST 0.024
BTC 13438.03
ETH 386.74
USDT 1.00
SBD 0.98