Interview Questions for a UX Position

>"Given a 2D array of 1s and 0s, count the number of "islands of 1s" (e.g. groups of connecting 1s)"

>"Implement a queue using 2 stacks"

>mf

Attached: Untitled.png (221x214, 111K)

Other urls found in this thread:

youtube.com/watch?v=o8S2bO3pmO4
twitter.com/NSFWRedditImage

CS101 questions. If you can't answer them you're a pajeet and should fuck off back.

It's for a UX position ffs. My portfolio is primarily in design and front-end.

And for the record, cs classroom questions like these are absolutely useless.

keep fingering your butthole though if it makes you feel superior knowing that you are a trivia monkey lol.

>front-end
aka programming
which means you are expected to be able to solve basic CS problems
go back ranjeet

>And for the record, cs classroom questions like these are absolutely useless.
Sure, but they're utterly trivial, and it's kind of worrying if you can't figure out a solution on-the-fly.

I don't think I could answer any of these problems even if I spent my entire life on them...

youtube.com/watch?v=o8S2bO3pmO4

Just loop over the array and when you find a 1 check the next to the right, down, left and do this for each 1 you find and log to position and then log it as a single island

Just make a stack and then pop it to another stack and it's a queue. You should really know this user

everyone on this board is so smart

The first one at least is really fucking easy, save the slightly unintuitive metaphorical use of the word "islands"

I don't think the first one is so easy, I would try using dynamical programming .

For the second problem the dequeue unwind the original stack in the second one, pop it and the unwind the second stack again in the original

These are both trivial exercises. What's the problem?

share the pseudocode for the first one

that's not 2D at all.

It is a 2d array, yes. Please tell us what you describe as 2d

Attached: 2dbestd.jpg (462x500, 46K)

don't listen to these smelly cs majors that insist they can solve every whiteboard question ever.

it's not normal for a ux position to ask these questions. just move on and keep applying.

>Just loop over the array and when you find a 1 check the next to the right, down, left and do this for each 1 you find and log to position and then log it as a single island
>You should really know this user
If you're going to act pretentious for knowing trivia, you should probably make sure your answer is right.

>Just loop over the array and when you find a 1 check the next to the right, down, left and do this for each 1 you find and log to position and then log it as a single island
LMAO you're not very bright are you?

DAFUQ is an island of 1s or groups of connecting 1s

do they mean the number 1 occurring two or more times next to each other in the array?

and what do they mean queue, do they want a queue that counts the 1s and 0s and if so would that even be called a queue, wouldn't that be called a loop?

1. outer loop is iterating over all pixels, inner loop is basic flood fill. Can use BFS or DFS
2. it's just sloshing elements back and forth between stacks, stopping when you're at the right one

1.a. Need to memoize all the 1s you visit in a hashset so you don't end up multiple-counting
2.a. As in, you designate one stack the "head" stack and the other the "tail" stack. Pushing to the top of tail stack is an enqueue and popping the top of head stack is a dequeue. Need to move all elements to the appropriate queue first

*appropriate stack

Every programmer on the internet is a genius. Specially anonymous programmers.

While we're at it, what should be the questions for a mid-tier developer who'd supposed to work on a project written mostly in C++ and PostgreSQL? I made a bunch of questions, but I feel silly asking them, and I also came up with an SQL problem, and I thought it was simple enough, but I gave it to our analyst who was eager to give it a go, and it took him 3 hours finally solve it. If we do decide to offer the SQL problem, do we do it before the interview or during it?

what the fuck
you don't need anything but a basic loop with two variables for the first problem

companies are just retarded at this point thanks to FAGMAN. leetcoder questions for every fucking tech job, white board interviews everywhere.
the last company I spoke with had the following interview process
>2 telephone interviews
>8 hour take home task
>6 hour interviews at the HQ with 6 different groups of people
the salary they offered was less than I earn now

Attached: 1567722994093.jpg (351x313, 74K)

This, unless you are applying leetcode companies aka big n.

I make 122k base as a dev in dixie, but would be spitballing my answers.

1. Brute force of this is straightforward. Iterate through and BFS/DFS when you get a hit. Set the 1s to zeros as you iterate over them if you want to flex some intuition or whatever, just make sure the edge cases work. That might reduce rechecking the same index

2. Stack A represents left side of the "queue", Stack B represents the right side. Stack A starts empty, stack b starts with the whole collection. When you iterate one step forward through the "queue", you pop the top item off of B and put it on top of A.

And for 1 there's probably a real answer or some dynamic programming stuff you can do

I wish my interviews were this easy, what in the hell does your degree say as your major, surely not CS. Most companies don't even care if you have the syntax down they just want pseudocode which is basic logic that you should be able to do.

At least there's one other non-retard in this thread.

I agree, it's a bad business practice at the very least and a self-destructive one at worst. They do it though because it's incredibly expensive to have a developer leave mid project and hire/train a new one.

What the fuck are you all talking about
BFS/DFS are algorithms for traversing trees.
You have a god damn array.

... how is that even a question. This is what I had to solve for my interview.

Attached: IMO.png (768x257, 34K)

>Explain in code or in writing how to iterate over an array with a pointer rather than direct access
>Explain what encapsulation is
>Explain what OOP is useful for
>Explain what inheritance is
>(Create some basic table structures in SQL) How can I query these tables with SQL.


Side note, if you ask for specific languages/syntax you are throwing away good candidates (assuming you rank them lower somehow). The best programmers have a sound understanding of logic, they don't need much more and assuming that Joe Blow is going to be able to get the syntax just right on paper when there's been intellisense-like features for every major IDE in the last two decades is just nonsensical.

>Prove
Keep proving those theorems you didn't write cuckboi.

I should've prefaced this post with what I've already been through with this shit company:
>2 phone interviews
>3-day on-site "interview"
>3 hours supervised JS test on day 3 lmfao
>now this shit

I am looking at leetcode right now and they basically copy and pasted the questions lmao. I thought the JS test was enough, but this shit is getting out of hand. ESPECIALLY for a UX position.

cslet

We're not refusing people for not knowing syntax, but we are refusing them away for not knowing SQL at all. Most of the business logic here is written in SQL and plpgsql. Thanks for the input.

Also here are some questions that I asked for C++:

>how are virtual functions useful in C++? How are they implemented?
>what does "Unresolved external" error mean when building your program?
>what are thread synchronization facilities for? What will go wrong if you don't use any?

you recursively check the up/down/left/right incices of the found 1 to find the entire island. it's a very graph-like solution even if it's happening inside an array

its a classic solution to a classic problem

So I can know SQL without knowing the syntax? lol

Oh shit now I get it. I misread 2D as 1D.

find another place to work for ux. at this point you might as well be applying to FAGMAN and making double your ux salary.

You can know the syntax for other database engines and not for PostgreSQL. All they have a gigantic amount of quirks which you have to use if you want your database to perform well.

lmao if the interview is gonna be like the that imagine all the bullshit you'd have to deal with day to day

How did I do, I haven't used C++ in probably 4 years

>Virtual functions allow you to declare functions that are inherited by child classes that can redefine the behavior of said function
virtual void foo(int x) = 0; or virtual void foo(int x) {}
>Unresolved external occurs when the compiler cannot find a reference to a library/function call, meaning that there is a problem linking your object code at compile time.

>They are used when threads access the same subset of memory, usually via a variable and allow for the threads to make sure that the current value of said variable is up to date and that any changes made will be reflected in other threads that have access.

This is so fucking easy. Getting this type of question in a faang interview would never happen outside of a phone screen.

It's literally just iterating over pixels in an image and performing flood fill on a given color. If you can't do that with your eyes closed you don't deserve any programming job.

>Be in interview at 100+ employee company
>Get to the "do you have any questions for me" part of every interview ever
>"What project management principles do you guys employ"
>1000milestare.jpg
>"What I'm asking is how does your team go about project development from a day to day generalized standpoint" (I'm talking to some HR lady)
>"Oh, every day they start with a meeting discussing previous days work and they do these things called SPRINTS"
>Thank her for her time and leave.
Any entry level developers, you need to understand that if a job listing or interviewer says either 'Agile' or 'Scrum' you need to walk away what that means is that they will work you to death on projects that have deadlines created specifically to make you want to kill yourself.

Also stay away from the word "Salary", anyone who is committed to paying you a set amount of money for an undetermined amount of work is a communist.

Function: Visit(A,cell)
cell = 0
foreach neighboring cell n in A
if n is 1
Visit(A, n)

Algorithm: Islands(A)
islands = 0
foreach cell in A
if cell is 1
islands += 1
Visit(A, cell)
return islands

>Virtual functions allow you to declare functions that are inherited by child classes that can redefine the behavior of said function
That's not the right answer because you can redefine behavior even without virtual, with overriding.

>virtual void foo(int x) = 0; or virtual void foo(int x) {}
That's syntax, the implementation question is about how calling a virtual function at runtime different from calling a normal member function.
Also for both of those answers I will try to get the correct answer out of the person during the interview, it's not like one mistake and your out.

>Unresolved external occurs when the compiler cannot find a reference to a library/function call, meaning that there is a problem linking your object code at compile time.
This is the right answer.

>and that any changes made will be reflected in other threads that have access.
That's quite wrong to my knowledge. You are accessing the same memory, and using a mutex won't affect what another thread sees in this location or not.

People generally struggle with the last question, so I have a follow up for it: imagine you have one variable of type int in the memory. You know that operations for reading from it and writing to it are atomic (the thread can't be stopped by OS in the middle of those operations). Are there situations where while working with this variable in multiple threads, you need to synchronize access to it? Where you don't need to?

you are a retard

For which part, not wanting to get hired into a shitty 80 hour work week or not wanting to get hired into a shitty 80 hour work week and also a set amount of money?

Wtf this is not UX, this is UI, UX is the research that goes into implementing new features, usability and function of a UI element, which is then refined by hi designers or implemented directly by front end devs

Don't worry OP. You and everybody else with an ounce of common sense knows these aren't appropriate UX role questions.

And while they're reasonably easy for anyone with a CS degree, they also aren't "completely trivial" to solve on the spot, as these retards proved - thinking they're easy (failing to recognize the steps of the solution) and providing hand-wavy, missing algorithms or outright wrong answers:
Took this long for a non-brainlet to appear

>>"Given a 2D array of 1s and 0s, count the number of "islands of 1s" (e.g. groups of connecting 1s)"
Got a similar question for an Electronics hardware engineer position. The twist was that I was not allowed to iterate over the 1s. I ended up recreating a contour algorithm but was unable to solve some edge cases.

class Solution {
public int numIslands(char[][] grid) {
Grid islandGrid = new Grid(10, 10)
.setMatrix(grid);

return new IslandCounter(islandGrid)
.countIslands()
.getNumberOfIslands();
}
}

Attached: 1561591593954.jpg (345x345, 11K)

oops. for that webpage's code it should be Grid(5,5)

was testing it with 10x10 locally:
1 0 0 1 0 1 1 1 0 0
1 0 1 1 0 1 1 0 0 1
0 1 1 1 0 1 1 1 1 1
1 0 0 1 1 0 1 1 1 0
1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 0 1 0 0 0
1 0 0 0 1 0 0 1 0 0
1 0 1 0 0 1 0 1 0 1
1 1 0 0 0 1 1 1 1 0
0 0 1 1 1 1 0 0 0 0

Number of islands: 5
Islands:
Island={(0, 0), (1, 0)}
Island={(3, 0), (4, 0), (4, 1), (4, 2), (2, 1), (1, 2), (0, 3), (1, 3), (2, 2), (2, 3), (3, 3), (3, 4), (4, 3), (4, 4), (4, 5), (1, 9), (0, 5), (0, 6), (0, 7), (1, 5), (1, 6), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (3, 6), (3, 7), (3, 8), (4, 6), (4, 7), (4, 8), (5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 6), (6, 0), (6, 4), (7, 0), (8, 0), (8, 1)}
Island={(7, 2)}
Island={(7, 9)}
Island={(9, 2), (9, 3), (9, 4), (7, 5), (8, 5), (8, 6), (6, 7), (7, 7), (8, 7), (8, 8), (9, 5)}

I don't think it works as it is.

You need to mark in some way the already visited 1's

Also is not the optional solution

>cell = 0

Ok, I didn't see that

I can do both of them
But I need time, I cannot do them in the 15 fucking minutes of time they give you in those online tests with those god awful online IDEs

>missed first line of inner function

bullshit

I probably wouldn't be able to do those on the spot
Oh well.

I've been interviewed for positions where nobody in the company even uses that tech and they've declined me for thinking they'd need to teach me about said tech, despite the fact I know that tech very well and explained many parts of it during face to face interviews. That's even worse, they don't even have any fucking clue what's going on, or why they're using it, so anything I explained was in one ear and out the other anyway.

This shit is so absurd.

telephone interviews
hour take home task
hour interviews at the HQ with 6 different groups of people
>the salary they offered was less than I earn now
Jesus Christ that's retarded. Imagine going through all that shit and getting shafted. Honestly, they need to make you a competitive offer on the basic principle that they took basically a week of work time form you.

I'm a very distracted person.

I didn't thought about altering the original table, and since it's in pseudocode I focuded on cycles.

I don't feel the need to lie on some anonymous Vietnamese board

>if you can't answer questions you never deal with you're pajeet.

It's more accurate to say, you can't answer these if you don't have a level of experience or desire to think the problem through. A pajeet who can leetcode and test dump can get through these shit filters easily.