Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

jesus WEP posted:

i put probably less than 10% thought into handing out the sixer than you did into making this post, it was literally just “ew what a gross word lol they’re getting their rap sheet stained for it”

so basically

DELETE CASCADE posted:

it was garbage. he broke no forum rules, the idiot mod just found it distasteful

Adbot
ADBOT LOVES YOU

jesus WEP
Oct 17, 2004


yeah pretty much

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
"i put barely any thought into my moderation activities" isn't the slam dunk you think it is

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.

DELETE CASCADE posted:

"i put barely any thought into my moderation activities" isn't the slam dunk you think it is

Get a load of this back seat 'erator

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

DELETE CASCADE posted:

"i put barely any thought into my moderation activities" isn't the slam dunk you think it is

the median Postin experience on the pos is like 10 years, we just need a mod for whoever's the little poo poo this year

e: i guess the fyad mods are takin care of hbag nowadays

bob dobbs is dead fucked around with this message at 23:19 on Sep 24, 2021

Mantle
May 15, 2004

jesus WEP posted:

i put probably less than 10% thought into handing out the sixer than you did into making this post, it was literally just “ew what a gross word lol they’re getting their rap sheet stained for it”

It's always projection.

Achmed Jones
Oct 16, 2004



lmao imagine whining about a sixer

hbag
Feb 13, 2021

whos whining about sixers now

Coco13
Jun 6, 2004

My advice to you is to start drinking heavily.

hbag posted:

whos whining about sixers now

Ben Simmons.

hbag
Feb 13, 2021

Coco13 posted:

Ben Simmons.

who the gently caress is that

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Achmed Jones posted:

lmao imagine whining about a sixer
and not even your own

cheque_some
Dec 6, 2006
The Wizard of Menlo Park

Coco13 posted:

Ben Simmons.

i appreciated this

a dingus
Mar 22, 2008

Rhetorical questions only
Fun Shoe
That was a funny sixer I'd wear that poo poo like a badge of honor

SporkOfTruth
Sep 1, 2006

this kid walked up to me and was like man schmitty your stache is ghetto and I was like whatever man your 3b look like a dishrag.

he was like damn.

Coco13 posted:

Ben Simmons.

lmao

hbag posted:

who the gently caress is that

a basketball player who has been kind of poo poo for the philadelphia, pennsylvania, usa seventy-sixers professional basketball team who, because he has been inexplicably poo poo in very important situations and is all in his feelings about being poo poo, now refuses to report to the team during the upcoming season and wants to be traded, but no one wants to trade for him because he has been poo poo.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
just had an intro call with some company who's hiring nearby, looking for an embedded system software lead.

Highlights:
- CEO is the one making recruiting calls, for a company of around 50 people.
- Pay: best offer would be around $30k less/year than I'm making right now.
- Startup. But don't worry it's very well funded, honest.
- Hardware is primarily off-the-shelf dev boards.
- I would have architecture and ownership over all platform code.
- Also, all code is written by an offshore team in India, including the code that I will own.
- Offshore team doesn't have full access to the target hardware.
- Also, they're not very good so maybe I can help them with the hard parts.

:lol:

Poopernickel fucked around with this message at 05:27 on Sep 25, 2021

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Coco13 posted:

Ben Simmons.

lol

Cybernetic Vermin
Apr 18, 2005

DELETE CASCADE posted:

"i put barely any thought into my moderation activities" isn't the slam dunk you think it is

i mean, it should fall under the schadenboner rule, where it is rightly bannable to make up dumb words and force them into every post as if that in itself is comedy.

cowboy beepboop
Feb 24, 2001

Poopernickel posted:

just had an intro call with some company who's hiring nearby, looking for an embedded system software lead.

Highlights:
- CEO is the one making recruiting calls, for a company of around 50 people.
- Pay: best offer would be around $30k less/year than I'm making right now.
- Startup. But don't worry it's very well funded, honest.
- Hardware is primarily off-the-shelf dev boards.
- I would have architecture and ownership over all platform code.
- Also, all code is written by an offshore team in India, including the code that I will own.
- Offshore team doesn't have full access to the target hardware.
- Also, they're not very good so maybe I can help them with the hard parts.

:lol:

pay aside, lol at the last 4 points

Sham bam bamina!
Nov 6, 2012

ƨtupid cat

DELETE CASCADE posted:

"i put barely any thought into my moderation activities" isn't the slam dunk you think it is
:qq:

PIZZA.BAT
Nov 12, 2016


:cheers:


DELETE CASCADE posted:

"i put barely any thought into my moderation activities" isn't the slam dunk you think it is

https://www.youtube.com/watch?v=kmcpiM3SSOA

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Poopernickel posted:

just had an intro call with some company who's hiring nearby, looking for an embedded system software lead.

Highlights:
- CEO is the one making recruiting calls, for a company of around 50 people.
- Pay: best offer would be around $30k less/year than I'm making right now.
- Startup. But don't worry it's very well funded, honest.
- Hardware is primarily off-the-shelf dev boards.
- I would have architecture and ownership over all platform code.
- Also, all code is written by an offshore team in India, including the code that I will own.
- Offshore team doesn't have full access to the target hardware.
- Also, they're not very good so maybe I can help them with the hard parts.

:lol:

oh that’s not so…uhh…oh drat that really nosedived hard

galenanorth
May 19, 2016

I tried taking a Codility practice exam in Python. The practice exam consists of 30 minutes for a single problem. The actual test is 110 minutes. The problem is writing a function solution(A) to find the lowest positive integer not in a given array of integers. Find an efficient solution for an array length <= 100,000 and integers in the range [-100000, 100000]. I assume that there has to be a positive integer in the array. So I wrote

code:
def solution(A):
    i = 1
    while i in A and i <= 1000000:
        i += 1
    return i
I got 100% on correctness, passing all the test cases, and a 25% on performance, for a total score of 67%. It's Python. If performance were that important, I'd be doing this in some other language like C++. How would I write this more efficiently, anyway? I might guess something involving sorting before the while loop, and then a binary search within the while loop. Python appears to use a linear search for the in operator.

So I'd throw in
code:
A.sort()
while binary_search(A, i) != -1 and i <= 1000000:
    ...

def binary_search(lst, target):
    low = 0
    high = len(lst)-1
    while high >= low:
        mid = (low + high) // 2
        if target == lst[mid]:
            return mid
        elif target > lst[mid]:
            low = mid + 1
        else:
            high = mid – 1
    return -1
I guess I'll just test it. The practice test allows another run-through. I got 100% on the performance this time.

galenanorth fucked around with this message at 20:17 on Sep 25, 2021

PIZZA.BAT
Nov 12, 2016


:cheers:


you probably want to sort the array first, binary search for the index containing zero or the next lowest number, then traverse up the array until you find a gap between numbers greater than one

alternatively you could traverse the array a single time placing all positive integers into their own array while keeping them in order and then do the same thing. that would probably be faster because we don’t care about the negative numbers

cinci zoo sniper
Mar 15, 2013




your solution has quadratic complexity, because list membership is o(n), and the i boundary check is not elegant either. there are a few ways that all should score better on performance

1 - keep everything as is and create a set for membership check. list membership is o(n), which makes your code quadratic in worst case scenario, whereas set membership is o(1)

2 - create a set of positive integers in your range, subtract set of input list from that and the first element is your result

3 - filter input list to positive values with a list comprehension, then sort it using default sort, then loop over range(1, len(l)) to check difference between current and previous number and deduce earliest gap to break the for loop

without knowing how your performance measure scores memory vs speed, performance order should roughly be 2 > 3 > 1 >> your version


edit: for 3 you would want to also compare the minimum value vs 1 to see if there’s something before the loop begins

cinci zoo sniper fucked around with this message at 20:30 on Sep 25, 2021

Achmed Jones
Oct 16, 2004



id guess that the n^2 implementation is a fail state, naive sort then traverse is a pass, and the optimizations pizza.bat mentioned (while talking about premature optimization etc) are extra credit. id probably put the second array in a heap during the filter pass for the delta>1 step but tbh when you get this far things are already fine. if i'm reviewing code, anything but the n^2 implementation is gonna be fine for non-trivially-small arrays

raminasi
Jan 25, 2005

a last drink with no ice

the thing to understand about that kind of question is that context in which you're solving it isn't "inside a python application, in which it forms no more crucial a component of the application's operation than you'd assume based on a simple reading of it." the correct context is "as an interview question," and in that context, you have to interpret it as being a proxy for several specific sub-questions, such as "do you know basic python syntax?" the sub-question you failed to answer correctly is "are unnecessary quadratic time operations acceptable?" and in the context of the kind of interview that asks that question, the correct answer is always "categorically no," even though this isn't true in the real world. lots of people would argue that this makes both the question and the style of interviewing dumb as hell, but you're still going to have to deal with it.

raminasi
Jan 25, 2005

a last drink with no ice
this is reminding me of an interview question i appreciated a couple of jobs ago where the "correct" path was to ask enough questions about the details of the input to determine that a brute force solution would be fine and just do that. basically the optimal solution they were looking for was some O(exp(N)) thing but N was, like, four, so who gives a poo poo. it was refreshing. they weren't looking for hotshot algorithm jockeys, they were looking for people who actively tried to understand the problem they were solving. (and it wasn't a trick question - if you didn't go down this path early they'd explicitly suggest it to you and see how you reacted.)

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
inplace heapify is rear end in a top hat thing to do but hey 0 extra memory

bob dobbs is dead fucked around with this message at 22:34 on Sep 25, 2021

FamDav
Mar 29, 2008
imo all of the situational optimizations are pretty meaningless to just answering the q, unless you can explain what kinds of situations they are/aren’t valuable. being able to explain the nlgn in place and n extra space solns is good stuff

cinci zoo sniper
Mar 15, 2013




i had an interviewer tell me that nlogn is faster than n because logn can be less than 1

PIZZA.BAT
Nov 12, 2016


:cheers:


cinci zoo sniper posted:

i had an interviewer tell me that nlogn is faster than n because logn can be less than 1

lol that’s precious

silvergoose
Mar 18, 2006

IT IS SAID THE TEARS OF THE BWEENIX CAN HEAL ALL WOUNDS




cinci zoo sniper posted:

i had an interviewer tell me that nlogn is faster than n because logn can be less than 1

good god

Vinz Clortho
Jul 19, 2004

cinci zoo sniper posted:

i had an interviewer tell me that nlogn is faster than n because logn can be less than 1

Numbers can be negative, therefore n is faster. QED.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
it is true that a nlogn algorithm can be faster than the n algorithm for the values of n that you care about, and it is also true that logn is less than one when n is one, but those two facts aren't actually connected and the second isn't the reason why the first is true

Achmed Jones
Oct 16, 2004



idk it seems most likely to me that the interviewer was making a joke. it also serves as a "does the interviewee assume others' competence or think everyone else is an idiot" check

Menacer
Nov 25, 2000
Failed Sega Accessory Ahoy!
i would absolutely assume that someone who said incompetent poo poo in a professional setting is actually incompetent. i have been burned so much in my career by assuming that someone saying stupid poo poo has some deeper reason for it, or they're joking, or whatever.

FMguru
Sep 10, 2003

peed on;
sexually

Menacer posted:

i would absolutely assume that someone who said incompetent poo poo in a professional setting is actually incompetent. i have been burned so much in my career by assuming that someone saying stupid poo poo has some deeper reason for it, or they're joking, or whatever.
"when someone tells you who they are, believe them"

Xarn
Jun 26, 2015

raminasi posted:

is "are unnecessary quadratic time operations acceptable?" and in the context of the kind of interview that asks that question, the correct answer is always "categorically no," even though this isn't true in the real world.
a quadratic thing in production code is either preceded by an input size assert, or a bug.

cinci zoo sniper
Mar 15, 2013




Achmed Jones posted:

idk it seems most likely to me that the interviewer was making a joke. it also serves as a "does the interviewee assume others' competence or think everyone else is an idiot" check

i implemented interview problem in 2 ways - o(nlogn) and o(n). they told me o(nlogn) is faster than o(n), and instructed me to further improve the former variant.

even if this would have been a joke, this is like “boss jokes about firing you” tier of appropriateness of jokes. and that’s not touching the obvious language difficulties the interviewer, a non-native speaker, was having.

Adbot
ADBOT LOVES YOU

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


cinci zoo sniper posted:

i implemented interview problem in 2 ways - o(nlogn) and o(n). they told me o(nlogn) is faster than o(n), and instructed me to further improve the former variant.

even if this would have been a joke, this is like “boss jokes about firing you” tier of appropriateness of jokes. and that’s not touching the obvious language difficulties the interviewer, a non-native speaker, was having.

o(nlogn) is faster than o(n)...... NOT

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply