I just had an pre screeing technical 'interview' where they asked me to do the fibonacci sequence in an editor. I couldn't do it in the half hour I had to do it even with copy and pasting code from the internet. I'm a senior in Computer Science.
not really, your problem solving skills will probably result in a catastrophic failure
just go look at some pretty pictures and you'll be k
Luke Johnson
That's really sad user. I'm a militaryfag who yells at Cisco devices all day, and I could accomplish that in about 12 minutes with internet access.
What exactly have you done in school?
Carson Ward
Smoke a lot of weed and program things I like and don't pay attention to things I don't like. So I have a lot of computer vision and ML projects. I can't even reverse a linked list within a few hours.
Alexander Cooper
Well now I don't feel so bad for you. Hope you didn't go into a ton of debt.
Plant shit seeds, grow shit weeds.
Joshua Harris
I didn't. I got full scholarships my entire way through so I have no debt. But I have no options at this point I think if I can't even do a fibonacci sequence. I'm actually still working on it and I still can't figure it out.
Owen Scott
Isn't this simple recursion?
t. CC fag who got rejected from all but one schools for transfer
Carson Walker
Yes it is. Should have taken a maximum of like 5 minutes.
Jason Thomas
>recursion Please, no.
Charles Bell
Cram Leetcode like every other normie CS major, if you don't want to wallow in pathetic NEEThood like everyone else here on Sup Forums.
Cameron Bell
have you read the python docs? They have a very elegant fibbonacci sequence solution in like 2 lines. Super neat
Sebastian Phillips
I really am trying. I spend probably 10 hours a day (currently neet over summer until school) doing leetcode. The problem is I haven't found the answer to a problem yet without resorting to looking it up. Even after spending 2+ hours on some questions.
Jackson Brooks
LOL if you do it with recursion then you're only marginally less retarded than OP. You gotta use DP, if you know what I mean ;)
Christian Murphy
f[n] = f[n-1] + f[n-2] where f[0] = 0 and f[1] = 1
Julian Morris
If by DP you mean the minimized version with no table then yes, otherwise you are just as retarded.
Justin Gutierrez
# Fibonacci series: # the sum of two elements defines the next a, b = 0, 1 while b < 10: print b a, b = b, a+b
Jayden Peterson
How are you attempting problems? There's a video from Google somewhere on Youtube where an employee walks through a whiteboard problem.
Basically, start with the brute force solution, and try thinking of techniques you can use to cut through the search space. If you can't even get the brute force solution, I'd be worried, but most interviewers would rather see you progress through your thinking process, rather than give them an autist staredown for 20 minutes and magic a linear-time solution out of your ass.
Adam Ramirez
damn homie what did you do in school?
Connor Miller
Pretty much nothing. I didn't study outside of class, if I went to class, but passed and kept my scholarships because my university is shit.
Isaiah Jones
>If you can't even get the brute force solution, I'd be worried
*worrying intensifies*
Hunter Jackson
If a becomes b, wouldn't be b+a end up being b+b?
Liam Edwards
>Computer Science >Science
they let you use an editor, that's really nice
your should work on your solving skills, find similar problems and solve in limited time you give yourself and develop calm confident
Joseph Nelson
no because the right side is actually a tuple in the memory
Jackson Long
they let you smoke weed in the military?
Jonathan Williams
>I couldn't do it in the half hour I had to do it even with copy and pasting code from the internet suicide is a valid option
Ryan Scott
Most people hiccup on the small complication that the 100th number in the Fibonacci far exceeds the maximum unsigned integer value of even 64-bit computers.
Tyler Torres
No. Python has all kinds of shit that makes sense to programming brainlets but smells like horseshit to anyone that actually knows what the fuck a computer does.
Mason Turner
>find similar problems and solve in limited time you give yourself and develop calm confident
Yeah. I've been doing leetcode and failing. In fact I've spent the last three hours on this question:
2 nested for loops to try to pair up everything with everything ?
Ayden Ward
btw, you can train your solving skills even if you're fucking retarded by looking at solutions for a while and understanding them, thinking how you'd arrive at that, revisiting them the next day, etc
the human brain can be shaped and trained to do certain tasks relatively quickly
William Green
Show me your fizz buzz
Ayden Rogers
Bit too late to fix that now considering I graduate soon.
Evan Morris
that's not really a small hiccup unless you implement your own digit addition via int/char arrays or something which takes away from the problem's original "objective". Although I guess if you had 30 minutes that'd be more than enough time to do that too
I'm pretty sure I couldn't do fizz buzz without an editor, 20 hours of time, and Turing coaching me through it.
Daniel Lee
I realized I needed to do that. The last 3 hours has been spent trying to actually code it without any syntax or OOB errors.
Wyatt Torres
>can fizzbuzz >can sum primes under 2 million >can bubble sort >understand algorithms instead of blindly copypasting >can do trivial maths such as fibonacci sequence in a heartbeat >am better than OP in every way despite never going to school >have yet to get a call back, much more an interview It's not fair.
Brody Fisher
it's not the optimal solution but it's a good first approach
in interviews they'd probably ask you to come up with something better
>The last 3 hours has been spent trying to actually code it without any syntax or OOB errors.
practice coding too
you're a mess, you shouldn't be wasting time on bullshit and should be focusing on iproving your skills all day instead
Jace Williams
the power of a good resume and cover letter can work wonders
Alexander Stewart
Just get a new degree. You don't have to pay off student loans while you're in school, and then you get a tag a CS degree onto whatever you want to do.
Asher Gray
it's always a hash map bro
Caleb Mitchell
create/make up experience and put polished non-trivial code samples online
>can bubble sort there are much better sorting algos
Nicholas Jackson
>there are much better sorting algos it's a Sup Forums meme
Alexander Barnes
>The last 3 hours has been spent trying to actually code it without any syntax or OOB errors. Holy shit. How'd you make it so far? What shitty institution are you enrolled at?
Levi Cook
Do you have any side projects? The way I'm getting callbacks now is because I have a couple very large projects that use image recognition and ML to play video games.
Adam Phillips
Bubble sort is so comfy though.
Henry Wright
>practice coding too
I mean I spend most of my day practicing coding. I don't have a job so I wake up:
4 hours leet code, might solve one question.
4 hours trying to work on an OS I'm building.
4 hours with python and botting video games (working on Diablo now) with screen reading
and then 4 hours with c# improving a project that a decent number of people use.
I'm not exactly getting any better though.
Eli Smith
A shit one. 93% acceptance rate level shit.
Jackson Sullivan
>4 hours leet code, might solve one question. >4 hours trying to work on an OS I'm building. 1/10 made me reply
Thomas Gutierrez
I'm not bull shitting. It doesn't actually do much but it can launch a shell at this point. I just have..problems with algorithms they frustrate me.
Grayson Lewis
you never know cause if OP didn't go to school he might now know about the importance of time complexity, O notation, etc
Eli Hughes
Not him but I'll use double penetration
Hudson Myers
Anyone here have actually decent problem solving skills but always take a bigger roundtrip to solve stuff? I can come up with solutions pretty fast, but it's always some kind of spaghetti solution instead of something elegant.
Jaxon Fisher
how can you not be able to write a tiny code that compiles in three fucking hours?
Sebastian Hill
>Using DP >Not using binary matrix exponentianon method
Ayden Campbell
By being stupid? I don't know. I can't solve them. I can't follow the code or understand it and it becomes increasingly frustrating when it crashes on every single mistype I make or can't figure out why it's going OOB.
This doesn't happen with stuff that I do on my own..I know exactly what it needs to do and how to make it do it or I can figure it out. I can't do it with this stuff though and I don't now why...
Brayden Fisher
elegant solutions are usually more difficult to come up with
Owen Jackson
>but it's always some kind of spaghetti solution instead of something elegant. you need to learn to discard your own shit solution and keep working in better ones
it's hard as fuck btw because your brain already got its "reward"
Mason Perez
>It doesn't actually do much but it can launch a shell at this point lol I'm amazed people still fell for it after that, as if it wasn't obvious enough already
Carson Robinson
they let you out of high school with that reading comprehension?
Caleb Roberts
There's literally a closed formula that you must've seen in linear algebra class
Gabriel Ramirez
Just had a job interview, i had to reverse a string: Did it recursive, they almost fapt to my code.
Daniel Lee
Writing javascript for too long addles the brain.
public static int[] Main(int[] nums, int target) {
foreach (int onum in nums) {
foreach (int inum in nums) {
if (onum + inum == target) { return new int[] {onum, inum}; } } } return new int[]{0,0}; } int[] nums = new int[]{12, 11, 7, 2}; var res = Main(nums, 13); Console.WriteLine($"result = {res[0]} and {res[1]}");
Adam Baker
>doesn't like recursion You fories and whileies disgust me
Henry Ramirez
Really? It's just the last two number to make the next
Ethan Phillips
recursion is costly, not always appropriate
Grayson Martin
I mean yeah. I understand it. I just can't code it.
Colton Gutierrez
Start with facc, from there fib is a little step.
Landon Allen
tail recursion has a cost of loop faggit
David Baker
I know there's a nice pretty maths solution that doesn't involve recursion for value at n, but I haven't gotten to write anything recursive in ages. Rate my pajeet stack overflow, nerds.
Brandon Morris
This is C# right? Do people really use the big arrow instead of writing real c#?
James Rodriguez
Yes. By big arrow do you mean the lambda / expression body arrow =>? I'd probably argue that it's one of the few things that is real C#, being that the language started as a Java clone. If you're unfamiliar, it's traditionally used for lambda syntax in delegates, which was a pretty common answer to function context pointers. This exploded in popularity though with LINQ, which is still where you'll probably see most => meme arrows. There's a bunch of cool things you can do with them though, including using them for method expression bodies ( which is extra powerful now you can have functions inside of function scopes like any modern language ) and my personal favourite use is for a shorthand getter property. public int OCPlsDoNotSteal => _otherperson.CopiedHomework;
which is a syntactically clean way to make a getter for good immutable shit.
Christian Adams
I don't use LINQ because I care about performance. My understanding is that the fat arrow is just sugar for { }
Daniel Barnes
That's a fair enough understanding I suppose, for what limited cases you'll probably see it. I just don't use C# for anything performance intensive. It's main power is in collections, data, and top level applications. I'd use lambda for bindings, delegates, and work on non-load data. I find LINQ is very useful for writing things from SQL queries to general use algorithms. If it needs to be fast, it'll be written in something like D. And maybe for some libraries I'll write segments in tight loops instead. Worth also noting that LINQ is starting to get spookily fast as they're making the compiler for it smarter and smarter. It's also absolutely brilliant anywhere you're using anonymous objects.
Henry Harris
Was a TA for years. You need to learn the basics of looping problems. there's a few universally applicable looping methods, that you can then modify to fit most problems to slap together a brute force answer, basic CS 101 shit they "Should teach". Using A+B as example. Double for "n^2" loop , does all elements incrementing all B before changing A, then redo until done. Recursive solution loop, compute a solution using other solutions. "skip N" loops of form a0 + a1, i +=2. "Nlogn problem solving" which is just half diminishing with comparing between merges. This is brain dead shit, but you can solve most problems like this. You won't be a rockstar but you'll get through it. Grow some nuts m8
Maybe you're just not good at programming. I've met people in my life who just can't grasp code, you sound like one of those people.
My advice would be to find something else you're good at. You could probably train yourself into a code monkey, but ask yourself, do you want that?
Kayden Thompson
just be a web developer
Robert Martinez
It can, in fact, be done tail recursively in O(n) time and O(1) memory.
Christian Wood
none of these are impressive in any way
Aaron Miller
Yes, it's simply base cases, then fib(i-1) + fib(i-2). You can use memoization/DP to make a table to significantly increase running time since the naive implementation is O(2^n).
Not sure what OPs problem is
Cameron Howard
What shitty university was it? Any school worth it's salt would not pass a student without studying unless said student was literally Einstein or something
Aiden Clark
That's honestly not impressive at all. Perhaps you should work on social/writing skills instead
David Howard
Most of the time it's not the studying, it's the exams that matter. Most classes are "mandatory", but when you have easily 100 students per class, nobody ever checks. And a shit uni could easily not have any smaller classes/sessions, meaning you'd be able to not go there for the entire year but as long as you pass end of year exams you're good.
And if it's a shit uni exams could easily be complete horseshit as well.
Thomas Howard
Who the fuck do they reject? Fucking incarcerated felons?
Adrian Scott
for index, fibonacci_number in enumerate(fib()): print('{i:3}: {f:3}'.format(i=index, f=fibonacci_number)) if index == 10: break
sort the array in O(n log n) and add from both ends, increasing the index of the smaller number if the sum is below the target, decreasing the index of the bigger number if the sum is above the target : still O(n log n)
If the numbers are small and you want to invest O(max number) space you can do it in linear time:
Use an array index_of_number[ ], and use a for loop in the original array: compute target - a[i], if there is a stored index in the new array print it and i, otherwise set index_of_number[ a[i]] = i
Mason Bell
My university has 95+% acceptance (no one applies) and as little of CS majors I think even our program's not that shitty.
Brody Allen
>4 hours trying to work on an OS >can't write the simplest algorithm possible lol