Posts

Showing posts from September, 2022

Week 4

Image
 In this week I try to increase the difficulty to 1200 from 900 to see what I could do. When looking at the problem the wording had me a bit confused but after a little more time I got the grasp of what they were asking. First, we take an input t, which represents how many test cases there will be. I put the number of t in a while loop so that it will run through all the test cases. A new code I learned was "while(t-->0)" this means while t is greater than zero decrement so instead of "while (t>0) and then doing t--" I do (t-->). Second, we take the number of n sticks that there will be, which I put into a for loop to go till it reaches all the sticks and create space for a set name sticks. To get to this part took me while, after trying to figure out on my own I went to YouTube to figure out how I could hold these data points and figure out what height combinations I need. That where I found that we used a data structure called a set or hashset. From the l...

Week 3

Image
 The website I used was down so I went to a different website and noticed they had much variety when it came to difficulty so I chose a slightly harder difficulty of 938. I liked this website a lot because It gave me my own coding window that I can use to submit and test with, unlike the other site where I would post my code from eclipse. At first it can seem a bit more complicated the problems before but in reality they are very similar. We can first see that the first line, like all the other problems, has the number of test cases. After taking the test cases we can scan the 3 integers and compare them like the instruction say. After we assess D, L, R we can minus one from T so that when we reach the last line it will be done. The hardest part of this was getting the stuff you need of the instructions. Personally, I was a bit tripped up with the constraints I thought that I would be using that in my assessment but they just telling me the range of how big/small the numbers could ...

Week 2

Image
 During week 2 I did some more same difficulty problems but oddly couldn't submit them through the website, but I'm sure they work. First Problem is taking the "long" words and shorting. This was pretty easy I just took in a number (n) then if I looked at the "next"(String) and checked if the its between the length of 1-100 characters, then if it was more than 10 in length and if it was I would then Print first letter, the number of letters between the first and last, and then the last letter. Pretty easy but I was confused on format because I thought I was suppose to make it so that it would take the 4 inputs and then output them. But I figured out that you can copy the whole input and you'll get the desired output.  Code down below For the second problem, I need to take lines of ints, which have 3 numbers that dictate the certainty of three people 1 being certain and 0 being uncertain. So I did a nested for loops to go through array of numbers and made...

Week 1

Image
 Week one of me trying to improve my skills and hopefully achieve some success in competitive programming. Today, I looked at some YouTube videos from experienced competitive programmers and a lot of them have used a website called codeforces, which host competitions and problems sets for competitive programmers. I tried a problem after watching some long intro videos to see how it works and get a feel for what I might be doing. I tried the easiest problem because I've been out of practice with my java for a bit and the projects before were for GUI so it wasn't the same.  Below is the results and the problem description. I couldn't find any difficulty easier than 800 but I thought this would be doable because it was titled "math and brute force" so there was no data structures or anything. For the first couple of tries I forgot to save and my code had a tiny typo. After, this showed me how shallow my problems solving is. I thought I new exactly what to do I just m...