Thanks for coming back for round 5 of our interviewing process. Let's go into the whiteboard room.
Write a function which, given a set of characters and a positive integer L, generates all possible passwords from those characters up to a given length L.
>Thanks for coming back for round 5 of our interviewing process. Subtle. Well done. Mirrors life well.
Jackson Miller
You can't do it yourself, you have to rely on built-ins?
Typical codemonkey
Luke Phillips
I'm awful at dynamic programming
Julian Jones
>wanting the time inefficient solution
Anthony Harris
here you go boss man
import itertools import string
def passwords(chars, length): results = [] for i in range(1, length + 1): perms = itertools.permutations(chars, i) for p in perms: results.append(''.join(p)) return set(results)
x = passwords(string.ascii_letters, 4) print(x)
Gabriel Gonzalez
Sorry, we're looking for people who understand recursion.
Ryder Perry
here u r sir
Solution
James Bailey
Nice work Gurpreet! Here's 300k starting
Gavin Lewis
Hire me and I'll outsource this manual labor that you're spending excessive amounts of money on to folks in India. I can oversee them for appropriate compensation, and they will end up costing you less than the five other individuals you need to actually run the day-to-day in this area of your business.
Julian Price
>mfw I didn't have to do anything technical to get my engineering job
>EE job at a major defense company you have definitely heard of >literally had to look at an RLC circuit and tell them what it did >literally a band pass filter >learned that in circuits 101 w e w
Hudson Anderson
Nice lad. I'm working at a company everyone knows. I find these large companies care more about your attitude and personality more than your technical skills b
Brandon Wood
Yeah, my interview was 3 sets of 45 minutes meet'n'greet the team behavioral things, and one half hour "do you actually have this degree and did you stay awake for at least a couple classes" technical thing.
Brody Ward
def generate_passwords(char_set, L): password_set = set([""]) for i in range(L): old_password_set = set(password_set) for c in char_set: password_set.update(set([p + c for p in old_password_set])) password_set.update(set([c + p for p in old_password_set]))
>"hello welkm 2 my code tootoooorrrreeeyuhl where i vill teech you to write good jawah codes"
Tyler Brown
I think this works, but I feel like my code is always too complicated or verbose. set get_all_passwords(vector characters, int length) { vector fixed_length_passwords; get_fixed_passwords(fixed_length_passwords, characters, length); set all_passwords;
for (auto set: fixed_length_passwords) { for (auto pw: set) { all_passwords.insert(pw); } }
return all_passwords; }
void get_fixed_passwords(vector &flp, vector &chars, int length) { set current_pws;
if (length > 0) { get_fixed_passwords(flp, chars, length - 1);
for (char c : chars) { for (string s : flp.back()) { current_pws.insert(s + c); } } } else { current_pws.insert(""); }
flp.push_back(current_pws); return; }
Michael Edwards
>I feel like my code is always too complicated or verbose.
>tfw i have this exact problem during interviews and am told they were looking for
Eli Perez
I have a vagina give me the job anyways.
I think this is the most efficient possible solution.
Ian Wood
Alternative solutions:
I'm black please gib job I'm a tranny pls gib job
Jordan Morales
its ok, the biggest challenge in programming is writing non niggerlicious code
Jason Hernandez
>Aerospace engineer >Apply to a factory that makes RD33 for MIGs >Holy shit an idiot who wants to work for us, welcome we're glad to have you please join >the job is 10000% relentless beurocracy and lityle to no ingeneering. >busy collecting signatures, negotiating, writing and rewriting business letters all day every day. >pays 500$ month barely pays for transport, instant noodles and anime figs >get recommended for a job of storage engineer at an airport. >Holy shit yoy're qualified as fuck we want you >glorified storage keepeer giving our parts to requesting technicians >24h shifts with ~23h free time to shitpost or sleep. >pays decent living wages >mfw a good job just basically found me >mfw I barely do anything and can affor shit like moving from mom and buying a car >mfw boss encourages me to go for a promotion
I literally dont know what to do with this. Will probably blow my first paychecks on high end pc and more animu figures.
It doesn't account for arbitrary length and that's assuming ⍵ is passing the valid character set. NEXT!
Joshua Morgan
I'm in Moscow.
If my job was actual engineering I would probably stick for experience and titanium space magic.
But instead it was just beurocracy and copy pasting standard technical resolutions such as "the defective part X will still work anyway because ....". Also production oversight like >we're rufurbishing an engine, found a scratch on one ball in a bearing please come and sign that you visually confirm the scratch so we can throw it away >an engine blew up on test go there and just stand and watch entire disassembly process
The worst part is that while I was directly involved in titanium space magic and could stick my head in it to look inside i wasnt really engineering shit or getting fruitful work experience. I was a erannd boy in a monstrous post Soviet beurocratic machine mostly working with papers collecting billions of signatures.
Jaxson Jenkins
>storage engineer
is appending "engineer" onto titles randomly a common thing?
Xavier Cook
>being engineer in Russia Welp, time to move to Canada.
Joseph Moore
Well Im a highly qualified storage keeper with knowledge what the fuck the things are and what parts go where on the plane. I might consider it but I bet Pajeet is a preferable candidate, im not even diverse or anything
Grayson Williams
seriously that problem really grinds me gear wtf op this is difficult
Jayden Rivera
Just claim that you are gay, and hunted by Putin.
Dylan Murphy
>t. brainlet This is the most basic combinatorics problem possible.
here (you) go faggots function Fact(num) { if(num==0 || num==1) return 1; return num*Fact(num-1); }
function RandomInRange(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
function test(charset, length) { var SubSet = new Array(), i = 0 ; if(length>charset.length) { throw "CHARSET length must be bigger than length you faggots" } while(SubSet.length rememberBit) & 1) { RememberSet.push(charset[rememberBit]); } } SubSet.push(RememberSet.join("")); } return SubSet; }
I'm happy that I could demonstrate my skills in the last four rounds. I'm looking foreward to the the next 10 rounds and I'm confident I will convince you that I am the right person for the Junior Developer position internship without payment.
For the solution of this taks I'd like you to have a look at my GitHub portfolio where I already presented a couple of solution of the 0/1-KNAPSACK problem in 7 differnt programming langauges whilst using different algorithms and heuristics. I'd like to suggest the Meet-in-the-middle solution written in Erlang, because it makes intersting use of concurrency while being rubust against unusual input. Since you didn't specify the character set of the input I assume it's part of the task that we can't be sure that the chars will use UFT-8 cahrset, let alone ASCII.
The solution I provided in my portfolio does real time checking of over 17 differnt character sets. If inconsistent input is found, we get an immediate problem detection from the process. The supervisor tree will try to isolate all problems and solve the problem nevertheless with the remaining substrings.
Of course the those problems will get logged and (in case of loss of power) stored at a cloud server. (It hardly needs mentioning that I programmed my own cloud server which is fully encrypted in various ways and has 7 mirrors on differnt locations).
After the algorithm finished that user gets a summary of all errors and solutions. The best solutions (if there is more than one) are located in a seperate cvs file for further processing as well as written down in a graph. That graph is a png made with D3.js and is actually just a radix tree of the differnt solutions which should make it easy for the user to find a possible combination if such a requirement should arise.
I'd like to point out that this is simply a draft, and even though I wrote 13 specs as well as my own fuzzer I would not recommend the usage in production yet.
Liam Torres
this must be pasta, right?
Cameron Brown
Actually I wrote this just now.. :^)
You can tell from the typos..
Brandon Russell
Damn. You used to post these latter in day.
Blake Baker
im saving this, thats actually a really fun exserize
Sebastian Stewart
wow just wow
Owen Butler
Thanks for your interest in this position. Unfortunately we've reviewed your application and have decided we won't be moving forward with you for this role.
Thanks again for your interest in working with us. We'll be sure to keep you in mind if anything new comes up that's a good fit.
Ryder Perry
void pwGenerate(vector alph, int length) { srand (time(NULL)); vector result; for(int i = 1; i 0; j--){ target += pow(alph.size(), j); } while(result.size() < target){ string tmp = ""; while(tmp.length() < i) tmp += alph[rand() % alph.size()]; bool f = true; for(int j = 0; j < result.size(); j++) if(result.at(j) == tmp){ f = false; break; } result.push_back(tmp); } } for(int i = 0; i < result.size(); i++) cout
Austin Cruz
Noone posts APL without explaining every character user
Lincoln Martin
abloo bloo, cry some more
Adam Flores
I have to admit that I already expected this, since this is the third time I applied for this postition. And being completely honest I also have to admit that my solutions still were flawed. I know this comes off as a sutpid excuse, but I was probably too nervous to up with a worthwhile solutions.
I'd really like to thak you for for your time and appologize because eventually it wasn't a good investment.
I will work hard to improve my skillset to I can hopefully get this job, because I'd love to work for your company. If I ever get there I will compensate the company for my previous failures and will work extra nightshifts.
Thanks a lot for taking your time and see you next year!
- t. user
Elijah Ramirez
Easy.
function variations(chars,length){ var res = []; var a = [0];
var position = a.length-1; while(position>=0){ if(a[position]
Chase Edwards
>needing recursion for this lol
Jose Russell
>var >var >var res = [];
Michael Carter
>throw "CHARSET length must be bigger than length you faggots" That's not true. Charset of one character 'a' and length of three should produce 'a','aa','aaa'.
Is there a problem.
Landon Ross
Dunno, I got triggered.
Daniel Cook
Does the word var trigger you? Why?
Brayden Howard
Guards, take him.
Brandon Butler
function Fact(num) { if(num==0 || num==1) return 1; return num*Fact(num-1); } function RandomInRange(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function test(charset, length) { var SubSet = new Array(), i = 0, target = 0 ; target = (length>=charset.length) ? (charset.length+Fact(length)) : (charset.length+Fact(length+1)); while(SubSet.length> rememberBit) & 1) { RememberSet.push(charset[rememberBit]); } } SubSet.push(RememberSet.join("")); } if(charset.length==2 && length!=2) SubSet.push(charset[1]+charset[0]); else if (charset.length==2 ) SubSet.pop(charset[0]+charset[1]); return SubSet; }
void genPasswords(const std::string &chars, int length) { while (length > 0) { uint64_t passwordCount = std::pow(chars.size(), length); for (uint64_t i = 0; i < passwordCount; ++i) { uint64_t div = 1; for (int j = 0; j < length; ++j) { std::cout
Hudson Davis
Why not escape on a tractor to a real country
Asher Brooks
import random from datetime import datetime, timedelta
def combinations(charecters, length): result = set() start = datetime.now() while True: result.add(u''.join([random.choice(list(charecters)) for _ in range(random.randint(1, length))])) if datetime.now() > start + timedelta(seconds=10): return list(result)
Ryder Johnson
> Opens Eclipse We will start devil-up-ment of spring boot application
Hudson Torres
>output: ['a', 'b', 'aa', 'bb', 'ab', 'ba'] You missed '' in this reference output. The empty string is a possible password.
That's wrong, you want permutations with repetition.
Sebastian Gomez
#!/usr/bin/env ruby
def pwgen(c, l, s = '') return s if (l==0) r = []; c.each {|i| r
Adam Peterson
pwList xs = xs ++ [x ++ y | x
Gavin Jones
>round 5 of our interviewing process how desperate do you have to be to go to a 5th interview with the same retarded company?
Adrian Carter
I'm done bro. I'd rather be homeless than keep going through this shit
Angel Russell
yes.
e.g. Petroleum Transfer Engineer
Easton Cox
Remove the second password_set.update() and this becomes the best solution
def generate_passwords(char_set, L): password_set = set([""]) for i in range(L): old_password_set = set(password_set) for c in char_set: password_set.update(set([p + c for p in old_password_set]))
return password_set
>mfw brainlets need to import libraries and write 30 lines of code to solve this