RomeoFantastik's blog

By RomeoFantastik, history, 4 years ago, In English

Link to our epic upsolving session right after the round:

https://youtu.be/SdwVz4qzhkY

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey, guys!

I little bit late unfortunately but we have solved Round #641 — Problems D and E and Round #642 — Problem E.

You might find the approaches useful if you haven't up-solved them yet! Enjoy!

https://www.youtube.com/watch?v=SsV1BhWuDYA

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Let's hope there are no technical problems and Codeforces Round #639 (Div. 2) is on its way! Good luck to all!

As you got used to it, we will be live upsolving the round 10 minutes after it finishes on Algopedia: https://youtu.be/E7fiCGAqNJM

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Good luck to all of my hustlers on Codeforces Round #639 (Div. 2)!

As you got used to it, we will be live upsolving the round on Algopedia: https://youtu.be/HneuObfyDtw

See you there!

Full text and comments »

  • Vote: I like it
  • +25
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Good luck to you all in today's round and have lots of fun, coders!

As you got used to it, we will upsolve the most interesting problems of the round live at 8:20 PM:

https://youtu.be/0kr6YSroclg

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Good luck to you all in today's round and have lots of fun, coders!

As you got used to it, we will upsolve the most interesting problems of the round live at 8PM:

https://youtu.be/ppk9pXL9rR4

Full text and comments »

  • Vote: I like it
  • +19
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English
  • Vote: I like it
  • +10
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey guys, I will be streaming upsolving of the last Codeforces Round in about 30 mins. Hope I see as many as you there!

https://youtu.be/SS5eONgsluE

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey guys, I have seen a lot of your really enjoy this kind of video editorials for CF rounds.

So here are the 2 most amazing (solvable by me :D) problems from Round #630 — Div. 2:

F

E

D — still rendering...

Cheers!

Full text and comments »

  • Vote: I like it
  • -18
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Usual shameless self-advertisement!

Hey, guys! Lately I have seen a lot of my buddies' productivity graphs looking like this:

So, I've decided to share 3 tips from my life experience about how I manage to keep myself motivated, focus and productive as hell.

P.S: I am a Computer Science student auto-isolated in my dorm room. We are talking about 40 m³ here. It's pretty easy for a guy like me to get nuts in a situation like this. So let's get it started:

1. Put on a suit!

No bro, I'm not joking. It might sound stupid, but it's a game changer. As I said, I live in a dorm room, so it's really easy to get off track when your bed is literally 0.5 meters away from the table you study. The table you study on is the same one you eat on. Then I have the sink 2 meters away.

This setup almost screams a schedule like: wake up late, then watch some funny Youtube video, then eat something, take another nap, brush your teeth and play computer games. By putting a suit on, I imagine I am the CEO of my company, the king of my empire.

Yes, my empire is a dorm room, but every king with his empire. So it's a psychological anchor for me: when I have the suit on, I am beast mode. I work. I don't eat with a suit on, I don't play with a suit on, I don't sleep with a suit on. I just work.

Try it for 2 days. You don't have a suit? That's cool. Jeans and a t-shirt should do it. Anything else but pyjamas or underwear. You're a coder, not Superman!

2. Stay away from unhealthy food!

I know we are all programmers and we care about the mind, not the body yada yada, bullshit! Point me to one guy who would like to look like this:

Exactly. Take care of your body. Stop eating all that processed food which has got 0 calories, 0 fats, 100% sugar. It does not just ruin your body, it ruins your mind too. It becomes blurry, your energy drops significantly as your insulin spikes to the roof. It puts you down. And the last things you want in this period is to get sick and to not be able to use your mind at it's full potential.

Fix your diet. Meditate. Exercise. I was isolated in this dorm room(you can watch the video to see how small it is) for 2 weeks. And I have worked out each single day. And I hit every muscle group. You can be red on codeforces but you can't do 1 push up. No excuses bro!

3. Build a tribe!

You might look at some guys in thee community who are really good and they seem to be forever alone. No one is. They had coaches, they had buddies as good as them who they trained with. You need that. You need 2-3 people to train with.

(But yeah, please don't touch hands and keep it virtual in this period)

You will push each other's limits, you will motivate each other, set weekly challenges, contests, do CF virtual rounds and upsolve together. You don't have any friends? Dude, if you are reading this, then look where you are!

This is like the New York of Competitive Programming. It's impossible to not meet people and make friends. Even Errichto was kind to respond to my message about a YouTube collaboration when I had 300 subscribers.

Keep hustling and stay safe!

Full text and comments »

  • Vote: I like it
  • +76
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

In what context does this work?

As you probably know, there are two types of graphs in terms of their edges:

  1. Graphs with unweighted edges (the cost of traversing/processing/... each edge is 1)

  2. Graphs with weighted edges (each edge has a particular cost to be traversed/removed/processed/... particular not necessary unique)

There are a couple of classic problems on graphs, but one of the most approached one is to find the shortest path between some node(we call it the source node) and all the other nodes.

You are going to see this problem in a lot of different formats:

  • Could be shortest path from a set of nodes to some specific node => which is obviously exactly the same

  • You can have some "obstacles"(or "bad nodes" or "bad cells") => which is exactly the same but you are not going to include those nodes in your graph/algorithm.

  • You can have some forbidden actions(for example, you are not allowed to move from some node to another if their sum is X) => which is exactly the same but you are not going to include those edges in your graph/algorithm.

What I am saying here is that BFS is a standard algorithm. Solving a problem involving it is just a matter of how you construct the graph on which you will execute BFS.

1. How does it work?

Initially, you insert the source node in a queue. In that queue you will have the nodes for which you have found the shortest path. As long as that queue is not empty, you take the first node in the queue(known as front). Because you know it's shortest path, you will try out each of it's neighbors and if one is not visited yet, bingo! We now know the shortest path for that node too. What do we do now? We set it's shortest path and insert it into the queue.

2. Why does it work?

It seems like we know the shortest path from the source node to some node the very first time we visit that node. Why is this true tho?

Because the edges are unweighted. This leads to those nodes in the queue being "sorted increasingly" by the shortest path length. Let's suppose for a second they are not. How could we even visit some node with shortest path of 5 before a node with shortest path of 3? For getting to the one 5 units far away we have to traverse some node which is 3 units far away.

If the edges are weighted you probably know very well there is some mr. Dijkstra who thought of that before us.

3. How fast does it work?

O(n + m) where n = no. of nodes and m = no. of edges. But why?...

As we have said in the previous paragraph, each time we visit some node for the first time, we know it's shortest path. So each node is going to be processed(that means we set it's shortest path and push it into the queue) exactly once. Now, each edge A-B can be processed at most 2 times. If the first node in the queue is either A or B.

4. What about multiple sources?

We just push all of them into the queue initially. And that's it. It works exactly the same, no matter where that shortest path started from.

5. Some practical examples:

Almost all the problems with matrices in which you have to find "the shortest path to some cell with the condition bla bla bla" Everything similar to the Lee Algorithm. Those matrices are in fact graphs.

You can check 01-Matrix out. I have solved and coded it in this video, but don't you dare to click the link before you have tried to solve it yourself.

Lots of love,

Andy.

Full text and comments »

  • Vote: I like it
  • +19
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

My video on the topic: Shameless Self-Promotion

Have you ever noticed how disasters have a weird way of making things better, once the initial problem is contained?

Yes, the virus is unpredictable, has deadly potential, and should be of great concern to just about every human on the planet. So, what could possibly be a positive consequence of a life-threatening disease?

1. Code (and live) for the present, not for that offer

Yes, these are not the best of times, but a time to reflect on who we are and what is most important in life. For some countries, economy is at risk. But most of Software Engineer jobs give you the opportunity to work remote/from home. Either you have or not a job at the moment, you are not so pressured by this thought anymore. Maybe you come to the conclusion programming is not what you want to do in life anymore. Maybe it's photography, cooking or pottery (Brad Pitt pff..).

Or maybe this makes you realize how much you love it. Instead of dwelling on what might happen, focus on the present, caring primarily about the here and now and enjoying the moment, irrespective of the virus or what might come next. While a future-time perspective is also helpful for human motivation and well-being, a balanced-time perspective that avoids a future fixation or dwelling on the past is positively correlated with life satisfaction, general purpose, and overall happiness.

Virtual participate in a CF round, solve a LeetCode Interview Question(or make fun of me solving them on YouTube), start learning a new language, but set the goal in mind to do it just for the fun of it. I have literally started programming just for the fun of it, so let me know how that works. Or just take a break if you feel like it. It's going to be fine.

2. Set and reach goals that are usually impeded by lack of time

We will still need to fill our leisure time in other ways. Think of all the projects you have put off, all the books that you haven't had time to read, and all the things on your "to-do-list" that get pushed aside. Now is the perfect time for personal development.

Start working on that plan to grow 500 points in CF rating, to land that FANG offer next year, to dedicate more time learning and practicing. One factor that is positively correlated with happiness is generating wisdom. When we take measurable steps toward enhancing our skills, we feel better about ourselves.

With the availability and ease of access to online courses and instruction(Udemy, Errichto or tryhard dudes like me who try to grow a YouTube Channel and plenty of idle time, you just might emerge from the coronavirus crisis both a better coder and happier!

3. If you have a strong goal in mind, be aware of competition

For those of you very competitive, you probably know that whether it is Competitive Programming, Coding Interviews for FANG, pottery(like Brad Pitt pff..) or anything else, those committed are always the winners long-run. Consider taking a break and enjoy the little things in life but never stop hustling and practicing, being concerned if "you are on the right track" regards to your goals in programming, being concerned if your actions are aligned with these goals.

Don't forget that you have probably set some goals for yourself at the beginning of this year and made a plan on how to achieve them. I surely had my honest opinion about Crushing the coding interview goals in this video. and always be in contact with external feedback. That is why I love these platforms where users have a rating. It gives a competitive edge while providing you with real time feedback of your performances and progress. It is just priceless. Once raised in competition, you are always competitive.

Didn't want to make this post sound like some self development motivational BS, you tell me how much I succeeded. This community is not just a bunch of ordinary people, but in the top percentage of people, because we work on ourselves and committed ourselves to progress. This is what unites us and defines and why we should keep it like that, but in a fun, enjoyable manner too. It's a lifestyle after all and we are a team.

Lots of love, Andy

Full text and comments »

  • Vote: I like it
  • +103
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hello, everyone!

I have just brushed off my Subset Dynamic Programming knowledge by solving the problem Marbles (Div.2 E) from Round #585.

Very nice problem and a perfect example of how this technique comes into play when you need to try out each possible permutation or combination of elements in order to find an optimal one.

Rite of passage:

  1. n is really big, buuuut.. why are there only 20 different colours? Should be backtracking or Subset Dynamic Programming!

  2. Each possible solution corresponds to a permutation of these 20 colors. Usually, if I find a brute force approach which tries each possible permutation, I'm pretty confident I can use Subset Dynamic Programming to reduce the time complexity from O(k!) to O(2^k) or maybe O(2^k * k).

  3. Looks like the mask is going to represent the subset of colors I have added into my permutation.

  4. At each step, I will find a color which was not added yet and I update the subset containing this subset and this new color.

  5. I can do this, awesome! But I need one more precompution before that...

Here is the link to my video tutorial: Codeforces Problem — Marbles ( Subset Dynamic Programming )

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Solving another classic: the Maximum sum sub-array problem.

I am amazed to find out how many of you guys have solved this question, but only so few know the approach using partial sums.

This video is for you!

Also, throwback to those amazing times I was shooting my "Bible of Coding Interviews and Competitive Programming" on the whiteboard from student dorm room.

More to come, Andy

Full text and comments »

  • Vote: I like it
  • +29
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Solving the Smallest K integers coding interview question in a different unexpected style: using a drwaing table.

Enjoy!

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

A little surprise for you at the start of this year. In this video I present 3 essential mindsets you need in order to crush your goals in Coding Interview, Competitive Programming and every little aspect of your life that you decided to improve on this year. I have grown them after all my experiences and failures.

3 Essential Mindsets To Crush Your Goals In 2020

Hope you find it valuable!

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Happy new year! I still can’t find a better way to celebrate and start this new year then by solving another Hard LeetCode Interview Question, which has an amazing solution and I recommend to think about it before watching all my video for hints: Minimum cost to hire K workers

Hustle hard, this year is ours! Andy(Romeo)

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey guys, for those of you who don't know me, that's alright, I still like to think of myself as one of Santa's little goblins.

And what do goblins do? They carry the gifts! One gift I have for those of you who haven't checked it is... another problem, this one is Harder as I took some time to come up with the solution again: 132 Pattern

Hope you still believe in Santa

Much love,

Andy(Romeo).

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey guys, merry Christmas! This is the first time I actually do this, some of you might not like my present, some of you will, but Santa can't satisfy every child, right?

My gift for you is a... problem, solved and coded in C++: 2Sum

Hope you believe in Santa and keep hustling!

Much love,

Andy(Romeo)

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Day 3 got to an end and the best problem of day 3 was by far "132 Pattern" from Leetcode, simple but amazing problem. Here is me solving the problem of the day: https://www.youtube.com/watch?v=pqCy9Z4x4qs&feature=youtu.be

Given a sequence of n integers a[1], a[2], ..., a[n], a 132 pattern is a subsequence a[i], a[j], a[k] such that i < j < k and a[i] < a[k] < a[j]. Design an algorithm that takes a list of n numbers as input and checks whether there is a 132 pattern in the list.

This problem is our introduction to the Stack data structure. Amazing interview question, we are going through 3 brute force approaches until getting to the final idea in linear time.

Join the Competitive Programming and Interview Questions Mastermind on Facebook for daily challenges, tips and tricks and sharing experiences: https://www.facebook.com/groups/453242718909088

Full text and comments »

  • Vote: I like it
  • -9
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey, guys! Day 2 of the journey got to an end and I like what I have accomplished! Here is the YouTube video with the problem of the day, with a nice Dynamic Programming idea, very good as an introduction for beginners in this field. I give my bulletproof formula for solving this kind of problems from scratch. https://youtu.be/Mu8f39maU6Q

Also, make sure you check first day video out, if you haven't by now: https://www.youtube.com/watch?v=wt_2UZzQYf8&t

Also, 2 daily challenges was posted in the Facebook group too. If you like talking daily about nice problems encountered and interview questions, or talk about some theory or experience, make sure you join the group: https://www.facebook.com/groups/453242718909088/

Hope you enjoy it guys and see you tomorrow for day 3! Keep hustling!

Full text and comments »

  • Vote: I like it
  • -9
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hey, guys! Day 1 of the journey got to an end and I am very excited to present you the most interesting problem I solved on YouTube, which is a Div.2 C (DZY loves sequences). Here is me explaining the solution, then coding it in C++ from scratch. https://youtu.be/wt_2UZzQYf8

Also, I posted a cute interview question in the facebook group, along with it's solution. If you like talking daily about nice problems encountered and interview questions, or talk about some theory or experience, I invite you to join the group too: https://www.facebook.com/groups/453242718909088/

Hope you enjoy it guys and see you tomorrow! Keep hustling!

Full text and comments »

  • Vote: I like it
  • +35
  • Vote: I do not like it

By RomeoFantastik, history, 4 years ago, In English

Hello, world! I am not new(anymore) to the programming world, but I will have a period in which I have to prepare hardcore for Competitive Programming Contests and Technical Interviews. So, I have decided to shoot a "from zero to hero" journey on my YouTube in which I will solve one CF problem a day, starting from the easiest ones and increasing gradually the difficulty to Div. 1 C and D. I will also explain algorithms and data structures and share my experience. Join me in this crazy adventure! https://www.youtube.com/channel/UC4LyqX6MVkg7NU2qBbvrkSg

Full text and comments »

  • Vote: I like it
  • +39
  • Vote: I do not like it

By RomeoFantastik, history, 7 years ago, In English

Hi guys! I have found this problem frot main.edu.pl, it seems quite interesting and I can't come up with some solution. http://main.edu.pl/en/archive/oi/19/hur Can you help me?

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By RomeoFantastik, history, 8 years ago, In English

Hello guys! Can anyone provide me please the solution for the last problem of the 7th round of COCI 2015/2016? :D

Link to the problem is here : http://hsin.hr/coci/contest7_tasks.pdf

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it