Posts

Showing posts from October, 2022

Week 8

Image
 This week I went over some interesting videos. One video was from the playlist I mentioned in a previous blog and it was titled "Will it stop?". The video is about a problem that asks you to determine if the code will terminate(stop). To determine if it will stop we can mentally plug in numbers. n being less than or equal to 1 will stop the code so the first number we can try is 2.  2 goes in the loop and we get if ( 2%2 =0 )(true)  2/2 =1  and the code stops. So if n is 2 the code will stop.  3 goes in,  if (3%2 =0) (false)  3*3+3=12  if (12 %2=0) (true) 12/2 = 6 n if (6%2 =0) (true)  6/2 =3 and we get a loop.  we plug in 4 we get if (4%2=0) (true) 4/2 =2 and we know 2 stops the code. So from what we see it looks like even numbers will stop the code but if we look at the number 6 it turns out that is not true and we can see if when we can see that when we plug in 3. But when we plug in 8 it stops the code, which makes it look like that...

Week 7

Image
 This week I didn't do to much coding I did a couple of the intermediate "basic programming" problems. What I did do was look at the competitive programming playlist. First couple videos were about reversing a list and the algorithm for doing so. But what I really found interesting was the video "numbers game" where they go through this problem where 2 people play a game where there are two numbers, A and B, you can subtract A-xB or B -xA, but the first player to get <=0 is the loser. So the video goes through cases like what threshold would mean that (A,B) would be losing or winning for player 1. We looked at examples like (12, 15) where player one can take 15- (1)12 and get (12,3) and player two can make player one lose by 12-(3)3 which gives us (3,3) meaning that that player one will lose no matter what. we then look at if (b<a<2b,b) so if a is more than b but less than 2b and we try to figure out if this is winning. We find out that we don't hav...

Week 6

Image
 This week I felt I wasn't really getting the 1200 problems so I was looking on youtube and found that they have a learn courses on the website I use. I really felt I was struggling to digest the problems. It was like the problems were straight forward but I was missing a simple piece of knowledge to implement it into code. Doing the problems were not improving my skills very much I feel like it was just a problem that I was able to do more than me digesting the problem well at the difficultly I am at.  I started and finished the beginner 0-1 learning course. The one that has an X in it is "wrong" but the code logic is right. I just don't know why there is a compiling error with my scanner because its the exact same scanner as before but it doesn't like it this time, so I'll try again later( update: Its because there was no test input so it was giving me an error all I had to do was submit the code so it would give test cases with inputs ). But the codes here ...

week 5

Image
 This week I continued working on 1200 difficulty problems, but these one were not data structure oriented.  The first one was quite easy and straight forward. The problems states that we take in test case t and each case we take in a binary string and we decide if they are "good" or "bad". They're good if they contain "010" or "101" if they don't they are "bad". Pretty easy so I take in t, while t is greater than zero I take in my string and see if it contains "010" or "101" and if it does print "good" and if not print "bad". Second problem was not so easy it wants us to find the combination that matches N burgers and has the most premium burgers that money R can buy. The way the problem was set up seemed easy but every answer I thought of never was quite right, so I looked up the solutions and tried to understand the code but I couldn't understand the equation they were using and the...