Home

15Jun2022: Party overflow, Merge sort, Understanding a mistake

Created June 15, 2022

Party Overflow

Today I mainly worked on building out the signup function on the Party Overflow React app from my coding bootcamp. Building out the form and creating a "handleChange", "handleSubmit", also logout/signup/signin, and using "useNavigate" to direct the pages back once the form was submitted. Oh and error handling. I wrote everything carefully and was pleased to see that the form was working when I npm started it. Next up is getting the avatars together for the profiles.

Merge sort

I spent a long time looking over what was wrong with my code writing a merge sort and it's quite long with ifs and whiles all over the place. It ended up being that I didn't do return a_list at the end (facepalm). But now I have reviewed that code so many times I...I don't think I can write it from scratch haha but I get what it is trying to do a lot better for sure.

Understanding a mistake in a recursion problem on LeetCode

I gave up trying my method in the recursion function I was trying to do for the LeetCode challenge. I basically wanted two conditions for recursion - one was that if the length of the string I was slicing from === 0, return true, but I wanted false only to be true if the string was not length 0 and the index at which it was iterating was already the end of the string. Because I needed it to continue iterating through to slice the string given the condition, but I couldn't call this index variable (because it's not iteration it's recursion) before I was starting the recursion. I was really, really convinced that there had to be a way to do it, I just don't have the syntax. However, after asking one of my experienced dev friends and then scouring the discussion panel for "Javascript Recursion" as keywords for a solution and looking at 40+ solutions and not seeing it, I realize that it's probably not a way solve it.

It's interesting because it's a dual mandate almost between learning new methods of doing things/knowing what's possible to do, and being able to apply what you think is a computer-programming way of thinking to problems. To me it seems pretty logical, but it doesn't seem to work (and who knows maybe I'll find out somewhere down the road that it does work, I just had to write it in another way). Sometimes it's not that I don't have the logic to solve something, it's that my methods are not extensive enough (knowing what's possible). Other times, it's not that I don't have the methods, it's that there are more elegant ways to solve something - I suppose with more methods I have yet to learn is usually still the thing, but also sometimes you just don't see a potential route when your mind is fixated on solving it in a specific way. I'd say usually it's more about not remembering a method or not having learnt it yet. So it's really important for me to continue practicing, checking other people's solutions so I can see other ways of solving things, and continuing to study from books.

That's mostly what I worked on with coding today.

Catt xx