[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Failed a job interview

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 199
Thread images: 17

File: 1487305493206s.jpg (2KB, 125x91px) Image search: [Google]
1487305493206s.jpg
2KB, 125x91px
Just got back from a technical interview for a software development position (BS in compsci). Did not even make it through 20 minutes of the tech interview before interviewer said I wasn't getting the job.

Should I just an hero?
>>
>>59076464
yes. kill yourself.
>>
File: FB_IMG_1485542426251.jpg (39KB, 480x635px) Image search: [Google]
FB_IMG_1485542426251.jpg
39KB, 480x635px
Yeah
You should really consider it
>>
>>59076464
What did they ask you?
>>
>mfw /g/ realizes interviews aren't just fizzbuzz
>>
>>59076464
>things that never happened.
>>
>>59076620
>things that never happened

Yes. It seems much more likely that OP is a successful dev that just sold their startup to Facebook for a quarter billion dollars and needs to make up stories about their failures to feel like a common loser.
>>
>>59076612
They asked me to write a function that would find all repeating characters in a string and the number of times they were repeated. I tried to solve using a hashtable to get get the solution in O(nlogn) time? Basically just a simple hash that would track the number of occurrences per character. They stopped me when I was writing the hash function because I essentially made a 2d array that had the occurrences of each character in the second part of the array and use ansii for the "key." I made an incorrect assumption that the characters would not be double global characters or something like that?
>>
>>59076464
Prepare and do better next time.
>>
>>59076464
Enjoy the NEET life like the rest of us.
>>
>>59076684
That's basically what they said. They want me to come back in in 6 weeks when I've had more time to "knock off the coder rust."
>>
>>59076670
I also would have made that mistake.
>>
>>59076670
They put you on the spot like that during the "getting to know you interview"? Or was this a follow up interview? Either way you should have prepared
>>
>>59076670
>tfw couldn't do this in an actual efficient way
>have no idea

desu I know the retard way of just making a 2d vector or something or array the size of the sting if I already know the size and then comparing each character to the string and looking for duplicates
>>
>>59076702
Follow up interview. I studied quite a bit (2 hours per day for 2 weeks) but it wasn't nearly enough.
>>
>>59076695
Semi-serious question, how does one NEET successfully?
>>
>>59076670
so if you get an input like "abaab"
Should return (a,3),(b,2) or (a,2) or what whas their example?
>>
>>59076737
http://mulpwiki.org/index.php/Uncle_Remus's_Guide_to_SSI
>>
>>59076502
Having people tell me to kill myself is weirdly comforting. I think I've spent too much time on 4chan.
>>
>>59076746
It should be (a,3),(b,2). They didn't provide an actual example. They just presented the question and I gave my interpretation and assumptions. I wrote my own string and asked for information about what the answer should look like.
>>
>>59076765
Wouldn't it be obvious to just use bucket sort then?
Create an array cabable of containining all elements, then increment for each instance, then convert it back ibto whatever format when you are done. That would be O(N) and very easy to implement.
The problem with bucket sort is usually it takes up a lot of memory, but when you are constricted to letters, that is not a problem.
>>
Didn't you hear anon? There's a shortage of CS graduates!

Sorry, you're too white and male.
>>
>>59076670
>find all repeating characters in a string
>I tried to solve using a hashtable

LOL, you went for an extremely inefficient solution. The simplest solution would be to create an array of integers (initialize with 0), iterate through the characters in the whole string and, using the ascii value of the character as the index, increment the element of the integer array. This would all be done in a single pass.
>>
>>59076845
I honestly didn't get into it for money or job security. I've wanted to programmer since I was 10 years old. I am white and male, but I can't make any excuses. That's just an emotional crutch.
>>
>>59076853
That's what I did, but it was wrong and an automatic failure because it doesn't take into consideration double-byte character sets (Chinese characters ect.)
>>
>>59076896
Oops, sorry I didn't read the whole post. They sound very anal. Unless you're working for some international/foreign company, you wouldn't be using double-byte characters in strings anyway. I don't think they're really interested in hiring you in the first place. They probably have a lot of candidates or they already made a decision on who to hire, and they're looking for the quickest way to end the interview.

Regardless, the more inclusive solution would be to use a Map.
>>
>>59076670
Double global characters? You trying to say that you assumed the string would only only be ASCII-encoded and not UTF-16 (which is usually used for strings in-memory) or UTF-8 (which is usually used to store strings in files)? In other words your algorithm would only work for the extremely limited case of English text with no too-fancy characters. Seems kind of like a little thing to short the circuit for since that can easily be explained/changed, but I can get not wanting coders who are only used to dealing with the trivial, sanitized little "friction-less vacuum" test areas.

Hash table was the right way to go about it, though.
>>
>>59076953
They were pretty cool about giving me advice moving forward so I honestly can't complain. Do you mean like a hashmap? My code skills are really bad at the moment because I haven't been really writing much at all in the last 1.5 years. Just studying again recently.
>>
>>59076962
Ya, these are the areas were my lack of real world non-academic coding shows. Definitely got to work on that.
>>
>>59076464
Time to go IT bro

> higher job satisfaction
> higher job growth
> cooler people
>>
>>59076995
Is it really that much better? I did do some CCNA stuff and have some experience with load balancers, switches, routers ect.
>>
>>59076979
Yes, like a hashmap. My skills are rusty too. When you've spending your time with only one language on the job, you tend to forget about the stuff you've learned before.
>>
>>59076953
>Unless you're working for some international/foreign company, you wouldn't be using double-byte characters in strings anyway.

You say that, until some retarded user enters emojis into your form's input fields

Regardless though, it sounds like OP got screwed over if they ended the interview as soon as he made a mistake.
>>
>>59076896
Unicode fucked computing. It's the original cuck.
>>
Should've ask for bathroom and then copy this
http://codereview.stackexchange.com/questions/44186/count-number-of-each-char-in-a-string
>>
>>59077009
Yea, I did IT work in the military and it was pretty sweet. Granted, everything in the military has to be watered down so retards can do it, so contractors do more of the heavy lifting. I'm in school for CS right now and I can already tell the software world seems like it sucks. Everyone's trying to be some genius programmer dude, since that's who the instructors idolize. IT stuff that might be better starting from junior to more senior positions:

> systems admin / cyber security
> systems analyst
> network engineer
> systems manager

Basically the more niche the better. I've read stories of guys starting off on call center floors and working into systems managers.
>>
>>59077062
Thanks anon, I'll keep this in mind.
>>
File: Utf8webgrowth.svg.png (35KB, 602x354px) Image search: [Google]
Utf8webgrowth.svg.png
35KB, 602x354px
>>59076953
ASCII should have died in the 70's. There is no reason to be using fixed-length characters in 2017 and tons of reasons not to. Even if you're only using something for internal use, please don't use ASCII.
>>
>>59077077
>accommodating pajeets
Fuck them. We should have doubled down on ASCII.
>>
>>59076670
They were probably looking for a simpler nested loop. It sounds like you were a better programmer than your interviewers.
>>
>>59077077
utf8 is a fucking pain ot work with; there are three distinct "boundries" bytes, codepoints, and graphemes all of which have their own weird rules on how to display and when to use which. and this is all ignoring performance. at least fixed width parsing is ubiqutious and constant time indexing
>>
>>59077077
this desu

https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/
>>
>>59076670
I would have made that mistake as well. Depends of the language of course, if you are writing this in Python or Java you don't even have this problem amusing you limit yourself to their respective string/character types. In C if you are dealing with char* of course that's a different story.
>>
>>59077135
It certainly has some implementation drawbacks, but once that is done it shines for the user. I'm really glad it exists.
>>
>>59077135
And if I pretended all objects were squares it'd be a lot easier to draw them, but I don't think my users would appreciate the limitation.

Strings aren't meant to be indexes, they're meant for reading. Creating a human-readable data format explicitly to be human-readable and then limiting it based on (frankly trivial) computational concerns is just being lazy. I mean you would only run into non-constant indexing concerns when you're dealing with characters which couldn't be written under the alternative system.
>>
>>59076464
Sometimes even tech interviews are contrained to the "people like us" mindset.

No matter how good or wrong is your answer, if they dont feel you will be a match for their culture you are out.

A friend who now work for one of the big 4 got rejected by some d00d because of this, he was sad as fuck, but some months later another guy reinterviewed him and got hired.

So OP, not takong into account your proposed solution, sometimes people like intellectial clones to work with them, "maybe" that was your case

preparation for the exam is a requisite, but its not enough, better luck next time
>>
>>59076464
Did you ask them why?

How is your portfolio?

Don't get discouraged, just keep on trying until you get your foot in the door
>>
File: 1322796219001.png (57KB, 500x382px) Image search: [Google]
1322796219001.png
57KB, 500x382px
>>59077238
Thanks man. I'll be more prepared next time.
>>
>>59077168
Name one benefit of utf8 to an English speaking user.

Don't even mention emojis, they're a drawback, not a feature.
>>
>not just traping the interviewer into assuming your gender
>>
>>59077250
My portfolio is shit. I worked at a place were I was supposed to be writing code, but ended up doing network investigations almost the whole time right out of college.
>>
>>59076670
I'd fail this immediately as I would assume that it was just some easy fizzbuzz filter question
>>
>>59076464
are you an SJW?
>>
>>59077266
>Name one benefit of utf8 to an English speaking user.
The world is more than just the United States. Don't be so arrogant and assume that what is enough for you should be enough for the whole world. And using different systems for different regions is not sensible.

>Don't even mention emojis, they're a drawback, not a feature.
I agree with you there. The political nonsense it introduced is reason alone it should have never been introduced to unicode.
>>
>>59077309
Definitely not. Why do you ask?
>>
>>59077135
I forgot there are different ways to process grapheme clusters too.

>>59077216
indexing is important if you are trying to manipulate text or when you need to perform any sort of text validation (think content uploaders). For both you most likely want to deal with graphemes not codepoints. Im not saying that ascii is a better general purpose solution, but fixed width chars makes everything so much simpler.
>>
>>59077266
Can you write the for-each symbol (∀) in ASCII?
Can you write the pilcrow (¶) or the section sign (§)?
Can you write a musical note () or an astrological symbol ()?

Don't pretend like English is the one language we use and that it fits into a tidy little 256-sized bin, because that's simply untrue.
>>
>>59077317
oh, because that's an insta-reject in most serious firms. they're a walking liability.

sounds like >>59076953
may be right.

don't be discouraged, anon. one door closes another door opens
>>
>>59077349
also, just my 2cents...

usually they expect you to ask for specifications and clarification of the task before you ever start writing code.

read the first couple chapters of cracking the coding interview
>>
>>59077368
For sure, I have that book on it's way in the mail.
>>
>>59076995
No job security tho.
>>
>>59076995

What do IT people do, I mean the higher up levels who get to boss around the techies?

Once they have implemented a system do they just sit around all day and the company gives you get 150 grand for keeping an eye on things? The 2 people I know who had jobs similar to what I am explaining don't go to any effort to make their job sound hard.

As someone who has been fruit picking for 2 months to get cash for ryzen these IT jobs sound cushy as fuck.
>>
var str = "writing this while getting paid for it"

var m: [UnicodeScalar: Int] = [:]

for c in str.unicodeScalars {
m[c] = (m[c] ?? 0) + 1
}

print(m)


["g": 3, "o": 1, "e": 2, "d": 1, "a": 1, "t": 5, "f": 1, " ": 6, "s": 1, "r": 2, "n": 2, "h": 2, "p": 1, "l": 1, "i": 7, "w": 2]
>>
File: 1435627604609.png (82KB, 184x184px) Image search: [Google]
1435627604609.png
82KB, 184x184px
>>59077463
It's easy get paid to watch anime and browse 4chan.
>>
>>59077463
>Once they have implemented a system do they just sit around all day and the company gives you get 150 grand for keeping an eye on things?
Yes. Because when things go bad (and they do) you are the one guy to give orders and not fuck up.

It's kinda like the military: we don't use them that often so they sit around preparing themselves until we do need them.
>>
>>59076464

Yeah eat a bullet you worthless shit.

Got any savings? Go be a sex tourist in Cambodia until you run out first.
>>
Do the mobile web developer Van Life shit. Just live in a Van, drive around the country and build web services for small to medium sized businesses.
>>
>>59077146
>Some beta tester wants the software to handle Japanese

If the company doesn't do business with certain countries, there's no need to bend over backwards accommodate non-existing foreign users.
>>
>>59077530
You get paid for writing nonmaintainable code?
>>
>>59077719
This is the sort of thinking that costs thousands of man-hours in the long run.
>>
File: sweatyman123.png (89KB, 417x234px) Image search: [Google]
sweatyman123.png
89KB, 417x234px
>>59076837
>had algorithms class 1 and a half years ago
>already forgot what bucket sort is
fuggggg I should program more and watch less chinese cartoons
>>
>>59077719
>using built-in encoding libraries is "bending over backwards"
/g/ once again showing that they never actually make anything other than chintzy little homework problems. In any real framework you're never even given the option of using fixed-length strings.

The fact that there's ANY degree of resistance to Unicode is unfortunately making me think that the interviewer might have been justified in the decision if this is actually a mentality that exists in CS students. The last thing any big project wants is someone who waits until it becomes a problem to start doing things correctly.
>>
I have a shit tier IT job and it's still pretty alright. If it wasn't for the extra non-IT shit that I have to help out with it would probably be pretty good. I probably do no more than upto 3-4 hours work a day.

>tfw posting this at work right now.
>>
Why do Americans stop after getting a BSc? Do you not realize you're pretty much someone who only had an apprenticeship, but without the training and experience?
>>
>>59077595

That makes sense, thanks for replying.
>>
>>59077846
because it's a 4 year degree and a MSc is usually necessary if you do more scientific research

imo it makes much more sense than a 3+2 year MSc because most people are essentially just that, non-trained graduates without experience, but at the cost of one more year

We used to have a 4-year diploma program similar to that but EU fucked everything up once again REEEEE

t. German
>>
>>59077146
Good read ty
>>
s = raw_input("Enter string: ")
d = {}
for c in s:
if c in d:
d[c] += 1
else:
d[c] = 1
print d
>>
>>59077899
I wasn't being serious. I am getting a MEng right now and honestly the only reason to do it is because you end up more desirable for HR drones and with a higher salary cap. 1 year into the 2 year master's studies I still haven't learned anything new that is actually useful for the job later.
t. also German
>dFw kein Dipl-Ing mehr
>>
>>59077982
so this is a stupid question.
a german BSc is the quivalent to another country's BSc right?
'cause isn't the abitur like U.S. associate degree? but abitur is like highschool for germans?
>>
>>59078049
>a german BSc is the quivalent to another country's BSc right?
There is really no comparative scale at least for CS degrees in Germany imo, it's really heterogenous.

I've seen people close to getting a Google internship 2 years into their BSc, but some of the people I work with now 4 years into my degree (3 year BSc, first year MSc) can't write a proper line of code to save their fucking life.

It almost gets to the point where your grade is almost worthless and you only go to school for 5 years to receive a sheet of paper that shows HR you have studied but to actually get employed you need experience in totally different categories.

There are of course advanced topics like AI/ML, numerics, encryption and any kind of fundamental research where you will have a hard time learning outside of an institution, but then again, most graduates aren't becoming ML experts and of those who do, most of them go into academics anyway.
>>
>>59077750
Are you retarded?
>>
>>59078049
We switched to the Bachelor / Master system so the degrees would be equivalent, yes. However, the actual courses differ greatly like >>59078181 said.
I don't know about the associate degree so I can't answer that question. From what my friend told me who spent 6 months in the US, we have fewer opportunities for avoiding certain subjects than you do, and less choice between different levels for subjects. Mind you, I graduated in 2011 and a lot has changed since then. Abitur is now 2 years instead of 3 (grades 11 and 12, formerly 11 through 13) and the system for choosing courses has changed as well.

>>59078181
>but some of the people I work with now 4 years into my degree (3 year BSc, first year MSc) can't write a proper line of code to save their fucking life.
Tell me about it. I'm an EE and some people here can't integrate a polynomial, can't apply Ohm's or Kirchhoff's laws and can't even make an echo program in C or fucking Python.
>your grade is almost worthless and you only go to school for 5 years to receive a sheet of paper that shows HR you have studied
1000 times this.
>>
>>59076464
>Failed a job interview
> a job interview
you can cry when you fail like 30 you fagot

learn from it, get better, learn more
>>
>>59077949
>can do "for c in s:"
>can't do s[1]='a'
Kekthon
>>
>>59078488
what did he mean by this
>>
>>59078558
Python is a joke
>>
>>59078591
I still don't get his point. You can go through the string by index if you so wish, but there's little point. Why he would statically assign the first character of the string to 'a' is a mystery to me.
>>
>>59078606
*second
>>
>>59076464
it took them 20 minutes for them to realize you weren't black, a woman, or a tranny?
>>
>>59078606
>Why he would statically assign the first character of the string to 'a' is a mystery to me.
the point is that you can't

it's a shitty, slow as fuck interpreted scripting shit implemented in C which can't even do basic C shit with strings
>>
>>59078642
Observe.
s = raw_input()
print s[:1] + 'a' + s[2:]


Nobody is debating that it's slow compared to C.
>can't even do basic C shit with strings
By that logic C is also shit because it can't do basic Python shit with strings.
Everything has its use.
>>
>>59078676
>Observe
when even C++ is less verbose you have to question the decisions made by the designer of your slow SCRIPTING LANGUAGE

> Everything has its use.
yes, if your script language is all those bad things >>59078642 at least be capable of altering strings easily
>>
>>59078701
C/C++ is less verbose for that one very specific task which in the real world doesn't occur that often, and can be circumvented for better readability. C on the other hand:
>have to determine length of string first, or manually allocate memory, and manually handle memory allocation when length is changed, leading to more verbose code
>can't iterate over list objects, have to explicitly get them by indexing
>requires #include directive even for basic shit like stdio
>no built in string type with utility functions like replace, len etc.
I'm not saying Python is objectively better, but for some applications it is more manageable. For string manipulation in particular I always prefer Python over C because parsing strings is much more convenient there.
>>
>>59078790
>and can be circumvented for better readability.
That's not better readability.
>keeps trying to justify stupid decisions
Congrats, you're a cult.
>>
>>59076696
>They want me to come back in in 6 weeks when I've had more time to "knock off the coder rust."
You're not getting the job, lol.
Fucking failed wagecucks man, when will they learn ?
>>
File: 1314151512313.png (683KB, 900x900px) Image search: [Google]
1314151512313.png
683KB, 900x900px
>I studied quite a bit (2 hours per day for 2 weeks) but it wasn't nearly enough.
>studied for 28 hours to fail the interview and make a fool out of yourself
Holy fuck, this just got a lot better.
Wagecucks absolutely BTFO
>>
File: computer_science.gif (2MB, 320x240px) Image search: [Google]
computer_science.gif
2MB, 320x240px
>>59076464
>compsci
>software development
That is not related at all. What you wanted was software engineering, not computer science.
>>
>>59078987
He's probably just a shitty coder. Likely took him a long time to come up with the code. Made (+ corrected) a lot of small errors. had a hard time coming up with the correct syntax. Stuff like that.
And that is why the interviewers stopped him. Not because he made any grave mistakes.
>>
>>59076670
Did you explain what you were doing and why you chose your. decision? Explaining what you are thinking and talking out your decisions is way more important and getting it right. Like if you explained why a recursive loop would've inefficient and a hash table much better, the interviewer should have then said something like what about double global characters or whatever and then maybe have gone back to recursion. It's possible they actually wanted to see if you could write a recursive function instead.
>>
>>59076670
Stop being autistic and say why you are writing the code, and what you plan to do. They don't understand what you're trying to do

9/10 the interviewers are worse logic/puzzle coders than you are
>>
>>59077463
they fix pcs for devs
>>
File: crying-eating.gif (90KB, 480x270px) Image search: [Google]
crying-eating.gif
90KB, 480x270px
>getting rejected
>killing yourself

are you a 14 year old girl?
>>
>>59079865
>are you a 14 year old girl?
I wish.
>>
>>59076670
        int n = 0;
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
scanner.close();
boolean[] processed = new boolean[s.length()];
for (int i = 0; i < s.length(); i++) {
while (!processed[i]) {
for (int j = i; j < s.length(); j++) {
if (s.charAt(j) == s.charAt(i)) {
processed[j] = true;
n++;
}
processed[i] = true;
}
System.out.print("(" + s.charAt(i) + ", " + n + ") ");
n = 0;
}
}
>>
>>59080774
O(n^2) This is the naive solution that I pointed out wouldn't work at the very beginning of the interview.
>>
is this what they were looking for, no?

string = 'foobar'
chars = [char for char in string]
duplicates = {}
for char in chars:
if char in duplicates:
duplicates[char] += 1
else:
duplicates.update({
char : 1
})

for k, v in duplicates.iteritems():
if v > 1:
print('Found duplicate ' + k + ' with value ' + str(v))

>>
>>59081166
I don't think so. Someone else said that they were looking for a hashmap. This solution is way too inefficient. I actually mentioned that this is the first solution that comes to mind, but isn't the right one because it's slow.
>>
>>59077314
>And using different systems for different regions is not sensible.
I never said it was. they should learn English if they want to use the internet.
>>
>>59082043
They'd rather just not use your product, but a competitor's product instead.
>>
>>59078275
>Tell me about it. I'm an EE and some people here can't integrate a polynomial, can't apply Ohm's or Kirchhoff's laws and can't even make an echo program in C or fucking Python.
What the actual freaking fuck.

I'm a Freshman EE student and I can literally do all of these things in my sleep. My first semester classes went over all of those things, with the exception of Python, but if you can't work with Python you should probably kill yourself.
>>
>>59078676
>By that logic C is also shit because it can't do basic Python shit with strings.
But it can you fuckwit. You realize everything you write in Python is being done by C code, right?
>>
>>59077595
>It's kinda like the military
With obese manchilds and no PT
>>
>>59082172
That's the thing, you supposedly learn it in the first semester and then you _should_ be able to use it.
In reality, most people just try to barely pass by memorizing shit and never truly understanding even the most basic principles of electrical engineering or the underlying mathematics, then never think about it again and try to leave the actual work to those that did understand it.
Just wait 2 years and then present one of your fellow students with a first semester problem.

>>59082184
Oh okay, so C has a built-in function that replaces all occurrences of the character 'a' with character 'b' within any given string? It can do dynamic memory allocation for strings without the programmer having to think about it? Coolio.
>>
>>59082155
Sure, let me know which other Internet they decide to go with. I can do without them anyways.
>>
>>59082172
Wow you must be one of those "intelligent guys". How does it feels?
>>
>>59082223
The internet and most browser are perfectly capable of supporting most character sets, languages, symbols, etc. If your product/website/whatever isn't, those who want to use that will just use a different one that does. Which means loss of potential customers.
>>
>>59082217
>what are libraries
>>
>>59082269
Places full of books. Obsolete in the modern world.
>>
>>59076995
More like

>less job satisfaction
>have fun cancelling vacation waking up 3 in the morning because server is ded
>having to deal with the shit software developers produce
>be every users bitch or get fired
>layoffs en masse, because everyone and their dog wants to be an idling admin
>put up with asshole vendors like CISCO, Juniper or Oracle
>>
>>59076670

How did you fail this?

#include <iostream>
#include <string>

void letterocc(){
std::string word = "euphemism";
unsigned int occ = 0;
char letter = 'e';
for(unsigned i=0;i<word.length();++i){
if(word[i]==letter)
occ++;
}
std::cout << "Found " << letter << " \""
<< occ << "\" time(s)." << std::endl;
}

int main(){
letterocc();
return 0;
}
>>
Lmaooo fuck characters
>>
Had a couple failed interviews before I was picked up. Keep trying anon.
>>
>>59082426
This doesn't solve the problem. You have to count ALL repeating characters. Not just one
>>
>>59082488
I'll make changes to it later, gotta go back to work in a coupe of minutes
>>
>>59082535
It's solved further up the thread. Basically, a hashmap. The issue wasn't with my algorithm, it was with the execution. The explanation is in the thread too.
>>
>>59076670
I only know a little bit of C++, but couldn't you make a vector of 24 ints (1 for each letter in the alphabet) and have them all set to 0, then go through the string and each time a character is repeated you would add one to the vector at the location corresponding to the letter, then print out the which characters occurred more than 1 time? I think this would also have a runtime of O(n)
>>
>>59082554
This is essentially what I was doing. The problem is that it any takes into consideration ansii letters and not unicode stuff. It's explained further up in the thread. Basically I should have used a generic hashmap that could handle any char type.
>>
>>59077062
>>59077074

I started off on helpdesk now I do development and some sys admin after 6-7 months, no experience or education
>>
shit man can someone list me things that appeared in an interview? I want to be prepared
>>
>>59076670
>not using binary tree
>went for the short route b/c less code
maybe you deserve what you got
>>
>>59076670
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static int compare_char(const void *a, const void *b)
{
return (*(const char *)a) - (*(const char *)b);
}

static void sortuniq(char *str)
{
int len = strlen(str);
qsort(str, len, 1, compare_char);

char *pos = str, *end = pos;
while (*pos)
{
while (*end == *pos) end++;
printf("%d %c\n", (int) (end - pos), *pos);
pos = end;
}
}

int main(int argc, char **argv)
{
for (argv++; *argv; argv++)
sortuniq(*argv);
return 0;
}
>>
>>59082269
>what is moving goalposts
>>
File: costco - us 2013 clerk.jpg (76KB, 540x960px) Image search: [Google]
costco - us 2013 clerk.jpg
76KB, 540x960px
>>59076737
>drop the employment E
>get a comfy job in Costco
>>
File: this joke has gone way too far.jpg (36KB, 600x400px) Image search: [Google]
this joke has gone way too far.jpg
36KB, 600x400px
>>59082367
More like

>more job satisfaction
>tell boss to shove it, I put in for this vacation weeks ago, y'all deal with it
>the user is not always right, put them in their place and do some basic education
>lrn2powershell, automate everything and actually be an idling admin
>don't put up with their shit, escalate to their manager and threaten to cancel services

Sounds like you're not a very aggressive person, m8.
>>
>>59083015
>not using normal fucking array indexed by fucking characters, with constant access
>>
>>59076464
Wow, I've never been rejected so fast. That's impressive.
>>
>>59076670
I assumed it would be fizz buzz
>>
>>59077110
That's a pretty inelegant solution though.
>>
File: 1486264146721.png (13KB, 418x359px) Image search: [Google]
1486264146721.png
13KB, 418x359px
>>59077820
>tfw also IT, but also student
>tfw also posting on 4chan at work
>tfw not even sure what I'm doing with myself right now

Feels weird man.
>>
>>59076670
int a,b,c,d,e,f,g,h,I,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
For(int place=0;place!=no;place+place){
if(array[place]=='a'){
A++;
>>
>>59077671

Not OP but you're a cunt. Just saying.
>>
How do I into logic? I'm just starting out with my first language and when I'm following/watching tutorials I don't really understand why they do what they do.

The choices they make don't seem very obvious to me. Are there some book recommendations you /g/ents can give me?
>>
File: 12312312321123.jpg (31KB, 225x384px) Image search: [Google]
12312312321123.jpg
31KB, 225x384px
>>59076670
>>59076696
>>59076464

I graduated a few years ago and have been employed in a blue collar cheap ass job since which I had even before studying. I've applied to dozens upon dozens of jobs and been in an interview many times, and for a few jobs even a few rounds of the application process.

Even if application process can be frustrating, looking back I kinda appreciate the experience I've gotten with job interviews at multiple interesting places, and countries.

I got a firm job offer last fall from a multinational corp and am currently on company courses bound to start the actual work in a few weeks time.

I say that while you might have to an hero yourself, job hunting and interviews can be insightful experiences with a net positive effect on your career. I've gotten a lot of contacts to my linkedin in last years.
>>
how tf was a map not the answer? Especially given there need to take care of the extended character set?
>>
>>59076670
public static void main(String[] args) {
String input = "aababcafgAa";

Set<Character> foundChars = new HashSet();
Map<Character, Integer> mapRepeated = new HashMap();

for (int i = 0; i < input.length(); i++) {
char charToCheck = input.charAt(i);

if (!foundChars.contains(charToCheck)) {
foundChars.add(charToCheck);
} else {
if (mapRepeated.containsKey(charToCheck)) {
mapRepeated.put(charToCheck, mapRepeated.get(charToCheck) + 1);
} else {
mapRepeated.put(charToCheck, 2);
}
}
}

System.out.println(mapRepeated);
}


Is this a good solution or am i beyond retarded? Didn't understand the double global characters though.
>>
>>59076670

Fucking retards, the solution is to use a hashmap.

#include <unordered_map>
#include <string>

auto count_repeats(std::wstring s) {
std::unordered_map<wchar_t, int> out;
for (auto c : s) {
out[c]++;
}
for (auto it = std::begin(out); it != std::end(out); it++) {
if (it->second == 1)
out.erase(*it);
}
return out;
}


It's O(n).
>>
>>59076464
>failing a job interview
>having any other reaction than hitting the books like the fist of an angry god

Fucking up a job interview sucks, but it's a good way to discover your shortcomings. Take a step back from applying for jobs, address your shortcomings, and then get back to applying for jobs.
>>
>>59076670
>present a ridiculously contrived task that has nothing to do with the real world
>fail candidate for not pretending it's a real world problem hard enough.

I think that was uncalled for, but what I would be concerned about is your ability to choose the right level of abstraction. Which language was this? Does it have a character type that takes unicode into consideration? If the language has unicode support it should have a character data type that abstracts away this sort of stuff, and if it doesn't, expecting candidates to implement UTF-8 from scratch off the top of their heads would be uncalled for.
>>
>>59085512
This problem took me literally 4 seconds to solve in my head and under a minute to write code for

>>59085434

If you can't do it, you need to practice a lot more.
>>
>>59085434
One mistake

            out.erase(it);


Fixed.
>>
150 posts and nobody solved OP's problem.

HAHAHAH /g/ BTFO
>>
>>59085846
Solved, retard >>59085434
>>
>>59085532
>This problem took me literally 4 seconds to solve in my head and under a minute to write code for
In a language with no support for unicode?
>>
>>59085434
>
    for (auto it = std::begin(out); it != std::end(out); it++) {
if (it->second == 1)
out.erase(*it);
}

what's that part for?
>>
>>59084492
>implying that works for problems with numbers instead of characters
>having to think again after the interviewer change some minor part of the question
>>
>>59085512
Honestly, if I knew about the unicode catch-all I wouldn't take the job. I once declined a job because the interviewer asked me a bunch of retarded questions that had nothing to do with real world applications, and he didn't even know the answers to a few of them himself. Workplaces like that tend to be horrible, you are better off looking for a place where the other developers aren't retarded.
>>
>>59077671

>projection
>the post
>>
ohh my god i wish bobby shoot me
>>
>>59085969
>In a language with no support for unicode?
>what is wstring
Fucking python niggers.

>>59086449
He only wants *repeated* characters, so I pruned all the characters that appeared only once.
>>
>>59076464
The economy is good. Jobs are plentiful. Everything is great.
>>
>>59086776
oh, right
>>
File: 1464812331862.gif (454KB, 250x188px) Image search: [Google]
1464812331862.gif
454KB, 250x188px
> interview tomorrow for internship
> shit programmer
> mfw I read this thread
>>
>>59086776
What doe Python have to do with this?

Or C++ (unless there's another language with a thing called wstring that I'm not aware of) for that matter, given that OP hasn't mentioned which language this is about.
>>
>>59076670
int charCount = 0;
char char = 'x';
string string;
for (int i = 0; i < string.length(); ++i) {
if (string.at(i) == char) {
++charCount;
}

>>
>>59086977
Most job interviewers will let you choose your language. I solved it in C++ >>59085434

[shit language here]-niggers didn't know that C++ supports wide characters.
>>
>>59076464
I was going to say no but then you posted a thumbnail. That's failure on top of failure. Neck yourself my man.
>>
>>59084655
>TFW literally doing the same exact thing
Feels good man
>>
>>59076670
int i;
int array[94] = {};
for(i = 0; inputstr[i] != '\0'; i++) {
array[inputstr[i+32]]++;
}
for(i =0; i < 94; i++){
if(array[i] != 0){
printf("%c occured %d times", i+32, array[i]);
}
}

wa la
>>
>>59087110
Whoops I made a goof

array[inputstr[i]-32]++;
>>
>>59085434
Wouldn't this be O(2n), since the second loop has to check every entry again for a string like "abcdefg" with only single entries?
>>
>>59087189
Learn how big O notation works. There is no such thing as O(2n).
>>
Someone write the solution in Java.

Also, 2 simple coding questions:

>How do you reverse a string?
>Do you you detact duplicates inside a string? Assume 0-9, a-Z characters only.
>>
>>59076752
>taking 4chan seriously
>>
This is why I didn't go into CS. I enjoy computers and enjoy programming as a hobby, but jesus christ if i did it for a job i would barely scrape by and probably fail interviews
>>
>>59087212
Web dev here, never had to use it and just grasped the concept of it from this thread.

Got it thanks.
>>
How do you pass these interviews if you haven't had Data Structures or an Algorithms class yet? That's next year for me but need a job.

Seems like they treat non-CS majors the same as CS majors and ask you DS&A questions. You are penalized if you haven't had the courses.

Microsoft interviewed me for a non-progamming job as a math major and I failed because I didn't have DS&A yet. They didn't care.
>>
>>59087271
They care about how valuable you'll be for the company. Not what a piece of paper says you should know and might not know.

>Oh sorry, I didn't learn that yet
is not a valid excuse if they are looking for people who know about that.
>>
>>59087271
>How do you pass these interviews if you haven't had Data Structures or an Algorithms class yet?
You can't, that's basically what they're testing.. They wouldn't need to if universities had a proper examination
>>
>>59087374
>>59087336
I have a pure math degree. Never studied algorithms. I picked up CLRS recently and am understanding it due to my pure math background. I plan to go through CLRS and another Data Structures book-- next time I interview I would have went through a bit of CLRS, Data Structures, Elements of Programming, Cracking the Code and a shit ton of leetcode problems.
>>
>>59087472
>I have a pure math degree. Never studied algorithms.
If you have a pure mathematics degree and never studied basic algorithms then you went to a really fucking bad school
>>
I have a phone interview for an Amazon internship coming up, I'm looking forward to it.

It's gonna be my first real technical interview. Hope it goes well, but I'm not gonna worry too much. I feel pretty good about my DS/A knowledge but I'm gonna be brushing up on it. Any advice?
>>
>>59077135
ya well blame ASCII and ISO Latin 1 backwards compatibility for that.
>>
>>59087636
Maybe I'm not the one that should be giving advice... lol

You can check out hackerrank for some practice coding problems. It's the best site for practice I've used so far.
>>
>>59087636

On my Amazon phone interview they asked me to parse Morse code back into the English alphabet. So basically trim white space and split the string, feed the split parts through the parser to get the words in English then join the words back into a single string. My advice is, if you're white you won't get the job. Good luck.
>>
File: 1476664113323.jpg (48KB, 492x449px) Image search: [Google]
1476664113323.jpg
48KB, 492x449px
>>59087105
Perhaps our story is rather common. It's just redundant is all. Clock in, answer tickets, come back, shitpost on 4chan, customers come in, help them out, shitpost on 4chan after, clock out. Day in day out man. I just need something new.
>>
>>59087687
Damn, I don't know Morse code, guess I'm not getting the job
>>
>>59087720
I just started something like 3 weeks ago, it's cool though with my situation. I have super chill bosses that want us (us being the other student workers) to do projects based on what we want to do, so I for example want to do programming so I have an overall goal of redoing essentially the entire back end of automatic emails at my college (which is written in powershell by the way, just end my life now). Overall I love my job here.
>>
>>59087603
>If you have a pure mathematics degree and never studied basic algorithms then you went to a really fucking bad school


Math majors study shit like: Real Analysis, Abstract Algebra, Measure Theory, Functional Analysis, Topology, Algebraic Topology, Probability theory, Mathematical Logic, Geometric Group theory, Linear Algebra, Category theory and the like...

Algorithms is a CS course and it isn't a "fucking bad school" for not requiring math majors to take CS courses.

Math majors tend to do much better in Automata theory and Algorithms than CS majors. Because we aren't code monkeys like you.
>>
>>59087603
So go back to your fucking web dev job you piece of code monkey shit.
>>
>>59087874
>math major
>doesn't know algorithmic
>still has not said where he was enrolled

You were a 100% in an awful college.

Sage.
>>
>>59087889
>>59087874
You didn't get the job because you're autistic.
>>
>>59087914
Yeah because merge sort really fucking matters to functional analysis. Fuck off. Math majors don't have to touch code monkey shit so that is why it isn't required in just about any math department in the country
>>
>>59085264
Why bother with the set?
>>
Is IT helpdesk worth it as an in and first job at 20?
>>
>>59088280
I dunno, do you want to commit suicide at age twenty-one? If yes go for the helldesk job.
>>
>>59076464
that sucks dude, when I interviewed they just asked me to solve questions relevant to the job
>>
File: 1485635307066.jpg (18KB, 320x320px) Image search: [Google]
1485635307066.jpg
18KB, 320x320px
>>59076464
>tfw you hear horror stories of interviewers who have to hire people who cant do fizzbuzz
>tfw it never happens to you
>>
File: worry.png (229KB, 345x370px) Image search: [Google]
worry.png
229KB, 345x370px
>>59087220
>not taking the underlying truth seriously
Thread posts: 199
Thread images: 17


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.