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
tef
May 30, 2004

-> some l-system crap ->

CaptainMeatpants posted:

to weed out the undesirables we always ask:

for a given string, output a list of unique characters and their number of occurrences

like 90% of applicants can't figure it out

fizzbuzzin'

code:
>>> from collections import Counter
>>> Counter("lol butts")
Counter({'l': 2, 't': 2, ' ': 1, 'b': 1, 'o': 1, 's': 1, 'u': 1})
>>> 

Adbot
ADBOT LOVES YOU

ppp
Feb 13, 2012

by angerbot
i got some mad dirty puerh and its like im drinking an entire moldy forest

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

CaptainMeatpants posted:

to weed out the undesirables we always ask:

for a given string, output a list of unique characters and their number of occurrences

like 90% of applicants can't figure it out

i had one place ask me during an interview to determine if a string is a rotation of another, so i go and write a hacky longest common substring algo and get 'er done as they say

apparently it's one of those trick ones where you just concat the string and to a strstr. shame on me for not reading the "tricks of the trade: ace the programming interview!!!!" book

tef
May 30, 2004

-> some l-system crap ->
the only thing worse than interviewing a show off is being interviewed by one.

double sulk
Jul 2, 2010

tef posted:

fizzbuzzin'

code:
>>> from collections import Counter
>>> Counter("lol butts")
Counter({'l': 2, 't': 2, ' ': 1, 'b': 1, 'o': 1, 's': 1, 'u': 1})
>>> 

it's nice to know that stuff like this is built into python. permutations is another cool one.

tef
May 30, 2004

-> some l-system crap ->

Police Academy III posted:

please explain, this sounds wonderfully hacky

I almost forgot https://gist.github.com/295200

Dr. Honked
Jan 9, 2011

eat it you slaaaaaaag

trex eaterofcadrs posted:

i had one place ask me during an interview to determine if a string is a rotation of another, so i go and write a hacky longest common substring algo and get 'er done as they say

apparently it's one of those trick ones where you just concat the string and to a strstr. shame on me for not reading the "tricks of the trade: ace the programming interview!!!!" book

that's not a helpful question to determine the ability of a dude, it's just jerkery. gah

ppp
Feb 13, 2012

by angerbot
once a year ill listen to girl talk - night ripper. at an internship interview i talked about 90s bmws and the giant f1 bmw poster i have

coaxmetal
Oct 21, 2010

I flamed me own dad

tef posted:

fizzbuzzin'

code:
>>> from collections import Counter
>>> Counter("lol butts")
Counter({'l': 2, 't': 2, ' ': 1, 'b': 1, 'o': 1, 's': 1, 'u': 1})
>>> 

I often forget about a bunch of the cool stuff python has in its standard libs. COllections has some other cool stuff too, like groupby

ppp
Feb 13, 2012

by angerbot
if people ask for my github ill just show them my last.fm

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Shaggar posted:

i dont like that maps are called dictionaries in c#
dictionaries and maps are different thing. the c# Dictionary type is a dictionary, not a map.

coaxmetal
Oct 21, 2010

I flamed me own dad

ppp posted:

if people ask for my github ill just show them my last.fm

I got hired for my first student cj job partially because I mentioned that I liked Jethro Tull.

Shaggar
Apr 26, 2006

Janin posted:

dictionaries and maps are different thing. the c# Dictionary type is a dictionary, not a map.

oh yeah? whats the difference?

ppp
Feb 13, 2012

by angerbot

Ronald Raiden posted:

I got hired for my first student cj job partially because I mentioned that I liked Jethro Tull.

they hired you to laugh at you

JawnV6
Jul 4, 2004

So hot ...
wait are u guys talking about hashes?

Shaggar
Apr 26, 2006
HashMap is a type of map but not all maps are hash maps

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

JawnV6 posted:

wait are u guys talking about hashes?

i think perl/ruby are wrong here cause it's confusing as poo poo (even tho they are implemented with hashing algos)

map is the perfect name cause it's what we've been calling that concept (function from X->Y) since set theory got all hollywood

Shaggar
Apr 26, 2006
Map is correct because it is a mapping of keys to values

Dictionary is incorrect because dictionaries are a specific type of map

Hash is incorrect because it is a specific implementation of a map.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Nomnom Cookie posted:

preserve insertion order

lol you seriously think this is a bad thing

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
php arrays are pretty much god's own data structure. i have yet to encounter a problem i couldn't solve with them

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

trex eaterofcadrs posted:

i think perl/ruby are wrong here cause it's confusing as poo poo (even tho they are implemented with hashing algos)

map is the perfect name cause it's what we've been calling that concept (function from X->Y) since set theory got all hollywood

well "map" is already taken by the first half of the "map-reduce" concept

CaptainMeatpants
Jun 1, 2010

Tiny Bug Child posted:

php arrays are pretty much god's own data structure. i have yet to encounter a problem i couldn't solve with them

tahts good cause it's not like there are any other data structures in php

multigl
Nov 22, 2005

"Who's cool and has two thumbs? This guy!"

tef posted:

I almost forgot https://gist.github.com/295200

:whatup:

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

CaptainMeatpants posted:

tahts good cause it's not like there are any other data structures in php

yeah cause you don't need them. php arrays are literally all the good data structures rolled into one

abraham linksys
Sep 6, 2010

:darksouls:
code:
var string = "abcaddaaaaa";
var counts = {};
for (var i=0; i<string.length-1; i++) {
  counts[string.charAt(i)] = counts[string.charAt(i)]+1 || 1;
}
console.log(counts);
:3:

seriously i can't imagine any case where this would take > 2-3 minutes at most, drat

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

BonzoESC posted:

well "map" is already taken by the first half of the "map-reduce" concept

could be that i'm dumb but idk where you're going w/ that

Dr. Honked
Jan 9, 2011

eat it you slaaaaaaag

Anal Tributary posted:

code:
var string = "abcaddaaaaa";
var counts = {};
for (var i=0; i<string.length-1; i++) {
  counts[string.charAt(i)] = counts[string.charAt(i)]+1 || 1;
}
console.log(counts);
:3:

seriously i can't imagine any case where this would take > 2-3 minutes at most, drat

well done captain obvious

Shaggar
Apr 26, 2006

trex eaterofcadrs posted:

could be that i'm dumb but idk where you're going w/ that

map in map -educe refers to a proper map so idgi

abraham linksys
Sep 6, 2010

:darksouls:

Dr. Honked posted:

well done captain obvious

i was bored + just woke up

CaptainMeatpants
Jun 1, 2010

Tiny Bug Child posted:

yeah cause you don't need them. php arrays are literally all the good data structures rolled into one

sorry tbc i replied before i realized it was you, just disregard that, tia

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Shaggar posted:

map in map -educe refers to a proper map so idgi

ya that's why i'm confused too

GameCube
Nov 21, 2006

Anal Tributary posted:

code:
i<string.length-1
welp have fun working at best buy again

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

Anal Tributary posted:


for (var i=0; i<string.length-1; i++) {
  counts[string.charAt(i)] = counts[string.charAt(i)]+1 || 1;


what the gently caress dude

abraham linksys
Sep 6, 2010

:darksouls:

Werthog posted:

welp have fun working at best buy again

oh goddammit lol

brb killing myself

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Anal Tributary posted:

code:
var string = "abcaddaaaaa";
var counts = {};
for (var i=0; i<string.length-1; i++) {
  counts[string.charAt(i)] = counts[string.charAt(i)]+1 || 1;
}
console.log(counts);
:3:

seriously i can't imagine any case where this would take > 2-3 minutes at most, drat

dude...
http://documentcloud.github.com/underscore/

Police Academy III
Nov 4, 2011

tef posted:

I almost forgot https://gist.github.com/295200

it's beautiful, tyvm

CaptainMeatpants
Jun 1, 2010

Anal Tributary posted:

seriously i can't imagine any case where this would take > 2-3 minutes at most, drat

yeah that's the point of interview questions

easy enough to not be awkward, but a good judge of whether someone can solve logic puzzles well, or just desperately try to remember that top rated stack overflow solution

abraham linksys
Sep 6, 2010

:darksouls:

_.each(string.split(""), function(char) { counts[char] = counts[char]+1 || 1 }); is a cool one-liner but it's not like there's anything with just using a for loop

text editor
Jan 8, 2007

Dr. Honked posted:

personally when i look at code samples i'm looking at their coding style. you can learn a lot about a person by looking at their code.

for example, here is some code from a real candidate:


code:
 if if if
this was sent by the candidate in response to my request for code that the candidate was particularly proud of, that showed their skills. would you give this person a job? i wouldn't.

Code samples are also a way for candidates to show their enthusiasm - you can tell if a person likes to code, by the code that they write.

here's where you are wrong: the person who likes to code intentionally write it in the longest way possible because he loves typing in code so much :3:

code code code tap tap tap

Adbot
ADBOT LOVES YOU

Dr. Honked
Jan 9, 2011

eat it you slaaaaaaag

text editor posted:

here's where you are wrong: the person who likes to code intentionally write it in the longest way possible because he loves typing in code so much :3:

code code code tap tap tap

drat i never thought about it that way.. all those great programmers who have slipped through my fingers....

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