Skip to main content

Posts

Showing posts from 2021

Online Assesment Questions (with solutions and submittable codeforces links)

Sigma Rule #82: Questions looking hard are hard and vice-versa, period. Uber These quesions are taken from this GFG article and leetcode discussions.   Q1. There is a meeting scheduled in an office that lasts for time t and starts at time 0. In between the meeting there are n presentations whose start and end times are given i.e. the ith presentation starts at s[i] and ends at e[i]-1. The presentations do not overlap with each other. You are given k, the maximum number of presentations that you can reschedule keeping the original order intact. Note that the duration of the presentation can’t be changed. You can only change the start and end time. Your task is to maximize the longest time period in which there is no presentation scheduled during the meeting.   Constraints:  1<=t<=1o^9 0<=k<=n 1<=n<=10^5 e[i]<=s[i+1],   0<=i <n-1 s[i] < e[i] for 0<=i<=n-1 Codeforces Question link:   Editorial:   Hint 1: Think ...

Interesting properties of iterators

 Erasing in map in a loop. if you run this code: Consider 'mp' as map<int,int> for ( auto & it : mp) { a.erase(it.first); } This would give you a runtime error as follows: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc This is because when you are erasing it.first from a map and then in the loop you are doing it++ and it do not exist after erasing. So, this loop will work instead: auto it = a.begin(); while (it != a.end()) { it = a.erase(it); }

What's Next?

 Hey, I was just wondering about what next? I have made two good websites that are solving real-life problems and I am adding features, improving bugs, and all on sites, and that's pretty much it. I am doing competitive programming for a while now and it's good to have a decent rating on that too. But, again, what's next? What should be my plan for the coming holidays? A greater tech site that also uses AI or something? Or maybe, some site which helps me in someplace. Or an app or some other techy thing which I can make to make my and other life better in some small way.  Or something else? Maybe I should start freelancing and earning bucks for my work. Doing internships is also a good plan. Freelancing is somewhat better in a way though, for it grants me to get my own pace and finish the project as fast as I can.  Or maybe I should just stick to Data Structures and Algorithms, give some time to Dynamic Programming, Graphs, and all, and thus improving my chances for getti...

Handling Criticism and Mistakes

 I am very bad at keeping what is in my heart. I am pretty straight forward and very easily get offended by someone commenting on me or someone just ignoring me. This was becoming a serious problem for me, as I am not well experienced with such situations and as far as my problems go, I have a clear and simple way to deal with them: Create a Blog.  So, first of all, I get angry very soon and I am likely to get involved in fistfights or saying someone real bad out of temper which makes no sense at all. The first thing is to control anger and act very strategically. This is easier said than done.  I have some rules which I try not to break in an argument. Now, these rules are not at all tactics to win the argument, but these at least would help you in not being guilty because of a foolish reason. So, here are those rules: Be rationale and Respectful: If it is a school fight it's fair enough to punch your way out, but when you are in college or in a company, never ever lose ...

Data Structures and Algorithms Resources

 So, I think it's high time to write an article on this as there are almost hundreds of videos and blogs, but still, we find it difficult to have a proper syllabus and structure. First of all, I list all the resources from which you can learn the theory part at least: Abdul Bari Series on Youtube( link ): Though he teaches slow, I still think he is one of the best teachers to learn the theory of DS and Algo. Code-N-Code ( link ): Waqar Ahmed has made a brilliant youtube channel where you can find in-depth playlists on almost all data structures and algorithms. His approach is based on Competitive Programming and you would really like it if you are a CP fan. GFG: Yeah, it's always on the list! You should use it as a reference and not define your syllabus from it, as its number of articles is enormous. Just google stuff and you would always find it on top. For example, after getting a -100 drop in rating😣, you are on fire inside and see that DP is your weak topic. And the next t...

So much things to do, Yet Idle

It's kind of weird but sometimes, I just have tons of things to do, yet I am reluctant to do any of them, like some massive form of energy would come and do that automatically. And this is now for over a week, and I finally though of doing something which I am always ready for and excited for: writing a blog! Although it is just to motivate me, you may just read it for seeing how people get energy from what they love  😉. So, let's jot down every possible thing I gotta do in upcoming months: > CodeKaksha > Game of Codes( Making Blogs and slight improvements) > DTU Times: PhP, Laravel, SQL, and more importantly setting up my dev environment and understanding some codebase from top level. > GSOC: I have selected an organisation for which I have to learn Ruby on Rails. But that's not the point, I just have to  install it locally and understand company's vision. And raise and solve issues. > DSA: Yeah, all of these go to vain if I don't do this in JEE sty...