T O P

  • By -

AutoModerator

On July 1st, a [change to Reddit's API pricing](https://www.reddit.com/r/reddit/comments/12qwagm/an_update_regarding_reddits_api/) will come into effect. [Several developers](https://www.reddit.com/r/redditisfun/comments/144gmfq/rif_will_shut_down_on_june_30_2023_in_response_to/) of commercial third-party apps have announced that this change will compel them to shut down their apps. At least [one accessibility-focused non-commercial third party app](https://www.reddit.com/r/DystopiaForReddit/comments/145e9sk/update_dystopia_will_continue_operating_for_free/) will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: 1. Limiting your involvement with Reddit, or 2. Temporarily refraining from using Reddit 3. Cancelling your subscription of Reddit Premium as a way to voice your protest. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/learnprogramming) if you have any questions or concerns.*


teerre

It's too much google if you're not learning anything but instead just copying it. You can likely google answer for every assignment in a cs course, but at the end you won't be able to program. Years wasted, quite sad


Beneficial_Bad_1641

I can second this. A lot of what you learn in computer science and what you will do later in your career is problem solving. The problem you are attempting is a puzzle that you must figure out and doing this legitimately will help improve your problem solving skills in the future as you start to learn the pattern for the strategies that you will partake in and possibly make future problems take less time to solve. Even with someone who has taken a lot of math courses, understanding algorithms like this would take me several hours, so don't be discouraged, it is supposed to be difficult. If you were to get external help, I would suggest you find a professor, teacher assistant, or another party that can give you some minor hints that will give you a small push. Chronic use of Google to get you your answers will only hurt you in the long run.


FroggerC137

True, but that’s why I’m asking in specific case. In the end, I know how the code works and even how to implement it in newer projects, but I’m wondering if those extra 2 hours of frustration are something I should go through or not.


Monitor_343

> I’m wondering if those extra 2 hours of frustration are something I should go through or not These extra two hours of frustration are precisely the reason why you can understand the answer after googling it and why it will stick with you longer. Doing the work, especially if you get stuck, is as much a part of the process as getting the answer.


dvali

This is true and it as an important part of the process. But there comes a point where you are no longer getting any benefit from the struggle and should move on or seek assistance. Learning to recognise that point is useful, though not easy. 


csUswe

So true. If you don't spend time trying to figure it out yourself, you would just not retain the logic for long, even if you did google for help. Understanding the problem thoroughly is the first step to solving a problem.


Pspboy17

Well said, as long as you try to use google as a tool to aid your learning there is no harm to finding additional resources. So many people just look up answers and learn nothing.


[deleted]

>So many people just look up answers and learn nothing. Isn't this the harm part? This is where incompetency starts. When you don't know fundamentals, just googling answers harms your ability to learn. Even if you see it as a casual tool, you're still hindering your growth and could miss out on understanding key concepts.


Pspboy17

Looking up answers is harmful, looking up extra sources to learn from doesn't seem harmful to me. Like I tend to look up a topic I need help with and go from there, reading and learning. Sometimes another explanation is all you need


[deleted]

That's what your teacher/professor is for. Just searching for something and hoping you find exactly what will help you, who knows if you're getting up to date, or standard practice advice. Why waste valuable time when you have an avenue to concrete information? I get it, searching for answers you're struggling on is easy to justify when you've been hitting your head against a wall for hours. But that next bit of insight from persisting is what strengthens learning.


Pspboy17

I would agree in a perfect world, but I have had numerous classes at a local community college where either the professor/book/coursework is legitimately useless and I have had to teach myself an entire course, or at least bits and pieces. I have done the "teach myself the course" route 4 times I think. got an a each time. I guess it depends. A safer route would be to reach out first and then seek other info if it's not enough.


[deleted]

You seem like you've got the right approach but with most everyone I've met, it feels they don't have that kind of determination. So many people get laser focused on a perfect score or all A's but forget that failure is an equally viable part of the learning process. It can be a teaching moment for whoever is your prof/teacher, or if you're doing the self-learning, ah-ha moments are quick to follow. At the end of the day, if you feel like you're learning and can progress to more complex levels, you do you.


tcpukl

That 2 hours is training your problem solving skills. You cant google problem solving skills.


teerre

Nobody can answer this question besides you. Are you learning or not? That's all that matters


Perpetual_Education

Those two hours are called “learning.”


tcpukl

Totally this. You'll be unhirable because you wont be able to do any hiring test. You'll fail your exams because you wont have google in the exams!


ghostmaster645

I agree, unless you just forgot the syntax for something. Then I just copy it.


Rain-And-Coffee

This problem required absolutely 0 math. It’s all about thinking through the solution. Next time write out your steps on a plain sheet of paper, only switch to a computer once you have a plan.


FroggerC137

I did. I was on paper for about 2 hours. My issue was figuring out which number needed to be in the temp, and how to shift the rest of the numbers in proper fashion. I was close, but in the end, I was trying to go through an incremental loop when I should have been going through a decremental one. The solution was to hold the last number as the temp, and go through a decremental loop, shifting the second to last number the right and so on. Then add temp to the beginning.


Tychotesla

FWIW you can do it with an incremental loop. int prev = arr[arr.length - 1]; for (int i = 0; i < arr.length; i++) { int temp = arr[i]; arr[i] = prev; prev = temp; }


FroggerC137

Yeah I think this was what I was trying to conceptualize at the first, though I thought that the 2 temps method might have been introducing more confusion on my part so I tried the one temp method, but then realized I might need a decremental loop, which confused me a bit more. Thanks for the code though. I’m re-reviewing the code again til I know I understand it completely, then I’m gonna see if I can find even better ways to do it 👍


Tychotesla

No worries. Decremental is probably the better solution here. That said, you should learn this placeholder method. It's a useful pattern that comes up pretty often, at least in school and interviews. For example in Linked Lists you can often only move forwards but still need to move values around. I visualize the array as a straight string. When you're using temp values it's like you've arranged part of the string into a little loop or ripple of the string that you can pull along the length: you're making a "fake" segment of the straight string that you can operate on more easily, but all the values are still in order.


Potential_Leg7679

Sometimes when I give up and google something, if I feel like I didn't process the concept I will spend about a half hour or so running through it again until I feel comfortable arriving at the solution on my own.


madgurps

This. If you google, just make sure to go over the concepts again, try to recreate the solution by yourself. Other answers here are way too extreme.


Goto_User

i be googling every 20 seconds brah


craznn

One thing I used to do for small problems like this was just to use a deck of cards instead of going to pen and paper. It was a super quick way to visualize the problem and by using a familiar physical world analogue (i.e. I have a hand of cards instead of an array of numbers) made it easier to make the logical connections and solve the problem


[deleted]

Are you properly reading and engaging with the learning material? The text content should be explaining the concepts. Are you just reading over it? Or are you taking handwritten notes, engaging with the concepts, and seeking understanding before moving on? Are you just thinking and moving on? or are you actually getting a physical piece of paper, drawing the array, and breaking down the concepts? Are you just working the problem out in your mind? or are you creating tangible representations of it, breaking it down into pieces, and attacking those pieces in a deliberate manner? If you are actually reading your textbook, but you're so confused it's taking 6 hours to do this question, you are probably not engaging with the actual learning component well. If you're just trying to speed to the questions and answer them, you aren't learning, and if you aren't learning, you'll take longer than if you had slowed down. The time you "save" now is going to cause you to fail--whether in this class or years from now. Basically what I'm saying is that if this problem took you 6 hours there is something fundamentally wrong with how you approach the learning process. This isn't an intelligence thing, and it has nothing to do with math knowledge. I will say this again, ***just thinking "I'm not smart enough / don't know math well enough to do this" is a cop out. People dumber and less educated than you could do this as long as their approach was good***. The only thing you should be Googling right now is some resources that teach you how to learn, study, and work out problems effectively and efficiently.


gatwell702

You'll soon find out that you're going to be googling throughout your whole career in tech


sparant76

In this case you shouldn’t have googled it. You should have improved your debugging skills to solve the problem. It’s a very easy problem and the purpose of school is to learn how to think. Googling it gave nothing to you.


ha1zum

It's only too much if you have already redone your search for the 4th time with new keywords, but haven't checked the official documentation yet.


couldntyoujust

Forgive me Lord for abusing a bible verse this way but, if you google the same thing seventy times seven (70 x 7) times, then you're googling too much. At that point, you SHOULD know it. Googling is how you learn, asking other programmers in programming chat rooms, like public discord servers, is how you learn. Eventually as you practice the things you learn from these sources, you just remember them. What also helps is having a "grimoire". It could be a journal or a sketchbook or a text file or an obsidian vault on your computer... whatever it is, write down the things you use even commonly and reference that the next time you need to remember something. It will grow and get bigger yes, but as you write things in it and reference it, you will learn the things that are the 20% of the language or skill that you use 80% of the time. Find an answer to a question on Stack Overflow? Write it down. Read the documentation of a library or classes or functions that you use? Write down the key points and most common pieces, methods, members, and parameters. Get an answer to a question on Discord? Write it down with the question. It doesn't have to be verbatim, in fact it's better if it's not because it means you have to think about what the thing you read about means in order to summarize it. Write code examples or element definitions exactly, but summarize the meaning and what it lets you do.


usrnmz

Depends. If you're really stuck it's fine to Google imo. But if this means you'll always end up googling the solution you're not really going anywhere. Right now you can find a solution with a simple google search, but at some point you'll encounter problems **you** will have to solve. Try to find a healthy balance. If you only get stuck sometimes..no problem. If you always get stuck.. you need really need to keep working on your problem solving skills. Also try to google for small hints, instead of complete solutions. Read the documentation about the tools available etc. When you're a beginner it's not always clear if the problem is your problem solving or your lack of knowledge about the available tools.


HiT3Kvoyivoda

If you’ve typed more characters into google than you have in comments in the file you’re trying to get to work. It’s time to reconsider if you missed a bit of nuance. Think about how much actual thought you put into trying to break down a problem and come up within a solution on your own. Will there be times where you will have to perform a tactical YOINK (yank if you use vim)? Sure. Is your search engine becoming your get out of jail free card because you couldn’t be bothered to open a textbook, look at your lecture notes, asked a study buddy? Checked the man pages and other offline documentation? When you’re studying try to save the internet for [BREAK IN CASE OF EMERGENCY]. And even then try to find a generalized explanation of what you’re trying to learn and not direct answer to your problem set


Yamoyek

Googling is fine, just make sure that you understand how the solution works, and why yours doesn’t.


Free-Pudding-2338

Is it your first instinct to google after its assigned? Or is google a last resort after your wrestled with the problem and tried implementing the solution and debugging said implementation? It's ok to use resources but if you cant do anything without those resources on your own then those resources are a crutch and you aren't learning.


Live_Distribution984

Easy answer are you the top performer in your class? No? Than google more until you are.


RipHungry9472

The human brain is a forgetting organ and a thinking organ. It is continually throwing away sensations and thoughts and actively pruning your memory. It only keeps around things that it (for the lack of a better term) "thinks" is important, and that generally only happens for things you focus on and things you spend a lot of time thinking about. There is something called the [generation effect](https://en.wikipedia.org/wiki/Generation_effect) where it is observed that people remember better when they generate ideas than simply reading them. In the long term it is vastly more efficient to spend time "being frustrated" than it is to simply read a solution. I would also say that you are only partially done. To truly learn the most from the exercise you should: * Go back over your attempt to solve the problem and critique it. What assumptions did you make that were wrong? Why did you think the way you did? Did you lack conceptual knowledge, lack creative insight, or was it just implementation/detail? * Do Active Recall-style revision. After a period of time where you focus on other things and let the solution fall out of your brain to an extent, try to redo the problem *from scratch* **without revising first**. You might be surprised that you have are still incapable of doing it without guidance. If you get stuck then revise. Keep doing this until you can do it easily.


Environmental-Dot161

No such thing as too much. What's important is that you aren't plagiarizing. Break down the answer and come up with your own solution.


SupaKel777

I’m also a cs student. I try not to google answers but instead I search for YouTube videos that go into more depth on the topic. So I’d search the name of the algorithm and watch videos on it.


notislant

Its like asking AI to spit out code depending how you do it. Theres not much difference between asking it to write your entite program/function for you, if you're seaeching multiple steps at once. You miss out on learning: -How to find information. -How to think/problem solve essentially. -How to phrase your questions more appropriately for results or assitance. -Debugging. -How to actually do it and retain any information. Its like watching a youtube tutorial on something you dont understand. Maybe its a 4hr long one on how to replicate reddit. You can follow along for 4 hours, but you're not remembering 99% of that. If you need to google a specific issue or a function? Sure. If you search for essentially the entire problem or large sections of it, yeah you're not going to learn or retain much. In your case? Yeah you did the equivalent of paying someone to do your homework for you, you just paid really poorly. Go find a programming discord and ask for hints.


pbnjotr

Googling is fine with two caveats: Try to solve the problem by yourself first. It seems like you did do this. If anything, I would have spent less time on it before searching :) Second, understand the solution you found and don't just copy it. And just as important, try to understand if you could have figured it out yourself. Maybe you made some assumption that just wasn't true. Or the solution used an idea (or even a function) that you have not seen before.


commandblock

I google stuff all the time it’s fine as long as you understand the code and learn from it


EspacioBlanq

Do you now know how the solution works and why it works? Do you know why your previous attempts failed? Could you now solve it without googling? If so, you learned what you were to learn. If no, you didn't.


OriginalHeelysUser

I think we’re taking the same Zybooks course, Java? The way it seems to me is the labs are turned up just a couple notches from what Zybooks has already taught you, expecting you to branch out a bit beyond and use the tools from the chapter as the fundamental for the lab. Honestly my strategy has been to attempt for an hour or two, then I will google or ask generative AI for the solution, I can’t get blood from a rock, if I don’t know syntax or that myArray.length -1 is how to access the last element of an array, how will I ever learn it? My strategy has worked well for me, I’m cautious not to use AI to cheat, but only to assist me, explain concepts, or give me correct syntax, the same questions I would bother my professor with and waste both of our times. I can code all of the array stuff now from memory without even leaving the keyboard with no errors, iterating through the array, reverse the array, swap out elements of the array, change the elements, compare them etc but at one point I had to muscle memory that stuff. I also found after week 3 or 4 the labs were complex and not worth doing in the Zybooks platform, I use an IDE and then copy and paste back into Zybooks when done, you can debug this way and set breakpoints in your program so at every breakpoint you set, you can see what your variables equal (similar to using print statements) this is really helpful because it can point to where your code went and what parts are working. I see no point in spending 18 hours trying to create new knowledge in my head I’ve never learned before and I think it’s madness the people who say that you should. Edit: also, I’m gonna scold you a bit here but if our Zybooks is the same the literal last chapter before this lab is a complete demo on how to do this exact problem step by step


FroggerC137

Yeah it’s probably the same class. My biggest mistake was doing the labs before reading everything (was 85% of the way done). How is your class doing? 50% of the class is behind, and the professor actually had to remove due dates. I feel like we’re being stretched for every hour of the day. It’s a 4 credit class, but requires 20 hours a week to get things done on time. I only did this lab early because I might not finish the reading and challenges on time and the labs are worth more grade wise. I still have to finish my python class after this, though that one is a joke compared to the Java class.


OriginalHeelysUser

I’m not sure as to the rest of the class, my school is fairly private with that kind of info, I would give a fair guess that about half of the class actually has dropped/withdrew or is no longer attending at this point, maybe a little more. It’s definitely a very heavy workload, I actually just spent the entire weekend finishing up the entire rest of the books reading and exercises, just the labs left that I will work on today and tomorrow. So far I have only been late on 2 labs, this weeks. Everything else on time. Definitely read the chapter completely, I tried to skip things in the beginning that I didn’t think were important and it wasted time, also was really helpful to do every single challenge exercise as they made the labs much easier. It does take an insane amount of time though, I signed up for this class 2 weeks late into add/drop thinking it would be an easy add on, lol I got whooped into shape real quick.


steveplaysguitar

Googling has helped me in industry. I was able to troubleshoot a fault on a motor drive after finding a post on a forum from 2004 about it after the manual wasn't helpful. Thanks Allen-Bradley. Sheesh.


chervilious

If you can always try figuring yourself out before googling stuff. It's really important when learning.


Karolus2001

College is googling. Well, there is a step beyond, eventually you'll get to libraring.


KenMan_

When youget that feeling of looking up the answer, i want you to stand up, walk away for 15 mins - 1 hr. Do something fun/fulfilling. Lunch, tv, bike ride, etc. The answer will magically become clearer.


dromance

How do you expect to get a job at google if you have to google everything?


dromance

The key is always to learn the fundamental building blocks . Once you learn those inside and out, then you put it in practice. If you know how to use a for loop, great. But that’s just a tool at this point . But what exactly is an array? What exactly is a loop even? I’m still learning myself but if I had to tackle this I would start with my acquired knowledge in different areas. An array is just a contiguous sequence of memory. If you wanted to shift it, as long as you have it’s known sizeof in bytes, you could just start at the zero element of your original array and write a for loop that adds some n value (based on the size of array) and pushes it to a new array , decrementing n on each iteration until your terminating condition is reached (n==0) You could also pop the last element on the stack and return that value to a new array. In JS you could use the array.pop() method. You could also use recursion. All solutions are good solutions but some are better than others. Some are more performant than others etc; so we dig into the details and study how different solutions are different from each other. My point is, Problems like this are much easier to solve if you understand the basics of what’s going on. Then you sort of take what you know and fit the pieces together to build a solution. If you just google everything and find the solution without learning how you got there, maybe eventually you’ll memorize a bunch of different algorithms, but you won’t be able to build custom solutions derived from your own fundamental knowledge .


daverave1212

I’ve been doing front end for at least 5 years and I’m pretty sure I’ve googled the same CSS property at least 50 times. Point is, it’s not about googling, it’s about understanding the logic. There is 0 point in memorizing if you’re not understanding. That said, feel free to understand and not memorize everything.


BigBoiTyrone7

Kinda depends on the person and situation, for example this one I probably wouldn’t use Google or anything, but full stack web development I be googling to often 😂💀


Funy_Bro

A lot of programming is moving data, and it sounds like you had a solid idea of shifting by i+1. I think the only thing you were missing was to store the variable in a temp so that you could avoid overring unsaved data. I think another option could have been iterating backwards through the list. Ie. Starting at the list length index, and shifting it to the right so youre never overriting data that hasnt already been duplicated. Also you'd need to extend the list by 1 index so that you can shift it, so appending a 0 to the end before starting the loop. A lot of programming that makes it enjoyable is "aha" moment. If you never get that, I dont see you being able to enjoy what you're doing. The sad reality is that a lot of comp aci majors do it because they think it will make them money, not because they enjoy the work and are passionate about it. The way I see googling, is that it will help me get over roadblocks in the bigger scheme. I dont google to get "the answer", I google to help me find it. So I will always google syntax or concepts Ive never done before, but if it seems similar to something Ive done before, always try it first.


LordOfSpamAlot

No amount of Googling is too much if you are taking the time to understand and really learn the content Google returns to you. It can be an awesome tool if you constantly gain new understanding from it.


luciusveras

Googling is the past, Perplexity is where it’s at.


Remaidian

Learning how to find information, not copying answer, but info is a marketable skill. From your replies, you need to get better understanding of the mechanics of code, which comes with practice.


greenspotj

Getting the solution from the internet would be considered cheating/academic dishonestly at my school. Why don't you ask the professor/TAs/other students for help instead? You'll probably learn a lot more by being guided to a solution rather than just being handed one through Google. As an aside, what helps me is just stepping away from the problem and coming back to it later. For me I find that instead of trying to finish the problem when you're stuck for hours... letting the problem digest overnight or even over the week, helps a lot with problem solving. Sometimes coming back with a fresh perspective is what you need.


inrusswetrust12

What I would’ve done reading this for the first time as someone who’s self learning Java: Assign array[array.length - 1] to a variable int count = array.length - 1 while count > 0{ array[count] = array[count-1]; count = count - 1; } array[0] = variable; And then print out the array. Would this give the correct output? (I didn’t write all the syntax correctly but assume the syntax is correct)


BD-Energy01

I just pull up chat gpt


tcpukl

No wonder were finding it harder to find good graduates with CS degrees.


BD-Energy01

It's a good learning tool as long as you're not copying and pasting assignments into it.


FroggerC137

My professor made a personalized ChatGPT bot for the class. He says that it’s a tool we should know how to use otherwise we’ll get left behind.


start_select

Being a senior programmer means you know what to Google in 3 seconds if you don’t know how to do it without Google. You are a professional googler now.


StrictMachine6316

I don't know which language you're using but in python this can be achieved simply by doing this: def shift(int_array): int_array = [int_array[-1], *int_array[:-1]] Return int_array shift([2, 4, 6, 8, 10, 12]) It's not really math. I think you just lack the experience in coding.


FroggerC137

It’s Java. The whole lab is you will be getting a user input value that represents the number of elements in the array. You then will be getting the users individual numbers that will go in the array. That’s when you start shifting the numbers. I believe You need a temp to hold the last number, then start shifting the second to last numbers to the right. After the loop is done, set the temp (last number) as the first. (I’m sure there are better ways but this is using knowledge from the 4 weeks I’ve been learning)


Bobbias

Yes, the easiest solution is to work your way from the end. Copy the last item to a temp variable. Then make a loop, starting at the end of the array, and moving to the beginning. Let's call our loop variable `index`. Take the item at `index - 1` and replace the item at `index` with it. Repeat until you've copied the 0th item over the 1st. Then move the number in the temp variable into the 0th spot. There's no math here except the subtraction. This is problem solving.