The third question specifically required you to use arrays to store the prefix sums, i had calculated the maximum sum possible at index i (in O(n)) and I was iterating till the square of the number until it reaches max sum at index i, but only fault was I used map (didn't work), then unordered map (didn't work too).
I really like your content! Your answer to Candies actually introduced me to BITs. I figured out a way to actually solve this problem with just two BITs by just multiplying the answer by -1 if the left query index is even. It saves some memory and, i guess more importantly, is a bit shorter to write down.
@@MusmanK01 I am not sure what do you mean by "how much". Also I am studying in the Netherlands and having looked at the CS programs in the US appears quite different. In my course in the first year we have covered so far Set Theory, Calculus 1A, Calculus 1B, Linear Algebra, and Probability Theory. In the second year we cover Discrete Math, Statistics. (These are all different courses that we take related to math). In reality, I believe that if you are working as dev math does not become a "necessity" however it does give you a "competitive edge". But that's just my opinion.
I got the AC solution code for problem B just ~10s after the contest ended. Regretting a lot. I just submitted(coz the Submit button was disabled after the contest ended until now). For the 1st time in my CP life I managed to solve a Topo sort problem in-contest. I am happy for that. (But sadly 10s after it ended). Thanks for explanations.
@William , why cant we solve 'Perfect Square' Problem using rolling sum technique?, i.e. n-1 sum at each index , n-2 sum for each index , I tried but it gives WA.
For the fourth problem the multiplication factor should start from one right ? You started from zero. But I got the idea. Nice and neat implementation.@william
I really like your videos but I can't enjoy it fully because I'm learning python :/ do u think I should try C++ ? (I will continue python as well of course) In my country many of the schools use python so I started with that
same, that's my problem. Although, if you want to get into competitive programming, I would recommend learning c++ as it is the fastest. That is what I am going to do.
Since I have try several system, I believe C++ is better for CP because some problems I have time limit error when I use Python for same algorithm. If time limit with Python, the fault can be either in Python system (class, library is slower) or your code, but with C++ it definitely is your fault.
@@vuduynguyen5301 thank you for your explaination, indeed I've got some runtime issues with python but I'm not that good, it is often my code which can be optimized :') but I think I'm gonna start C++ for CP and continue python, thanks :)
Daniel Koo You can start with any type of language, but the most understandable for beginners is definitly Python. Try that one first and when you feel comfortable with it, you can try other one.
I went through your code properly and this is brilliantly written. How did you come with this way of coding, i.e keeping an active array for the nodes visited. Is this some standard thing or do you come up with these while thinking about the algorithm during implementation?
Ok, so we have to do Reverse topological sorting when the graphs are pointing like the way they are at 5:17. Normal topological sort will give you a wrong answer. For normal topological sorting then we have to store the adjacency list with arrows the other way around.
Knowing of algorithms on such advanced level is extraordinary. I am learning algorithms and data structures too. But what about making some software or hardware real world products? Are you interested in something else besides pure algorithms and data structures? Is any point to stop in this discipline and moment to start making something real? It is not a claim. It is just question for you Will, for me, for everyone on how to not to get stuck in learning loop
For the first problem I used O(n) approach and the solution was clear Even got correct answer for the sample test cases and myown test cases but gives WA on submit I checked if current element is m if yes then decrement m by one and continue Else m is reseted every time And when m reaches 0 increment counter and reset What is wrong anyone help
for this example - m=3, a[] = { 3,2,3,2,1 }, a[0] and a[1] will match but a[2] will not match and u will reset m=3 and move ahead to a[3] i.e 2 and as m=3 it will not match and u will move ahead to a[4] which will not match as well and ur answer would be 0 but it should be 1, so whenever u reset m check again if current element is m or not
there's even a hacking competition called CTF (Catch the flag). And it's not even just online, teams would go to a legit venue like any e-sport competition. many chinese join these events.
i want to join a coding group , it may be in whatsapp group or else , ; but i dont want to join those group which is by companies or organisation for learning , because mostly people in that group start with "how do i learn to code", but i know coding , just want guys to discuss with ,or maybe share and compete with if anyone has any such groups please i want you to get me a invite i know C,CPP,java , python , a bit about linux and a gamer , i got my data structures down good