Damn, sounds near impossible to get in. Do you remember what type of problem it was you struggled on?Sadly no. I felt I did pretty well for most of it but one session I definitely struggled and I think that sealed it.
Damn, sounds near impossible to get in. Do you remember what type of problem it was you struggled on?Sadly no. I felt I did pretty well for most of it but one session I definitely struggled and I think that sealed it.
Damn, sounds near impossible to get in. Do you remember what type of problem it was you struggled on?
Yeah, traditional coding interview advice is that it's fine not to know the answer right away and it's often even better if you don't, since you can guide the interviewer through your thought process. That isn't the case with at least Facebook. They expect an answer within a few minutes.
Did the trick have something to do with buffering or precomputation?It was a non-coding algorithm problem, basically they asked how to transform a file a certain way even though it couldn't fit into memory. There was a bit of trick to it I didn't catch on to and basically had to be guided to it (the problem would take roughly 5 minutes if you immediately caught on while I spent 20-30 minutes postulating different ways to do it). It's not the sort of thing I thought to study beforehand as I was more concerned about trees, graphs, sorting and all that type of stuff.
If Rust compiles to LLVM...can I use it on platforms that don't support it like Switch and Xbone? I know PS4 works.
wasm is already available.If they add a target for it, sure. From my quick searches right now, it seems Xbone uses the same CPU architecture as PS4. Since Sony added a PS4 target to LLVM, it might work* on Xbone, or require some easy adjustments.
Can't see Switch happening tho.
On that same note, I recently learned that LLVM is going to get a wasm target, so you could compile code for the web with Rust
* I have no idea what I'm talking about take this with a huge grain of salt.
If Rust compiles to LLVM...can I use it on platforms that don't support it like Switch and Xbone? I know PS4 works.
Thanks for the responses.
Did you end up getting an offer if you don't mind me asking?
Sadly no. I felt I did pretty well for most of it but one session I definitely struggled and I think that sealed it.
It was a non-coding algorithm problem, basically they asked how to transform a file a certain way even though it couldn't fit into memory. There was a bit of trick to it I didn't catch on to and basically had to be guided to it (the problem would take roughly 5 minutes if you immediately caught on while I spent 20-30 minutes postulating different ways to do it). It's not the sort of thing I thought to study beforehand as I was more concerned about trees, graphs, sorting and all that type of stuff.
Sorry to hear. I honestly don't understand the interview process, everyone I know who has applied has gotten rejected, and many of them are very good. My best advice is to try again in 6 months. It's definitely possible to get accepted on your 2nd or even 3rd interview.
I guess it depends on the nature of the file format in question, but as a purely general solution, couldn't you create an abstraction around mmap so that you could pass an arbitrary offset into the file, and it would mmap in slices of the file as needed, un mapping earlier portions if you cross a boundary? This way you only ever have in memory a fixed amount of data, but you can access arbitrary offsets on demand.
For onsite, you basically show up to the lobby and wait for your initial interviewer. They stick you in a conference room and you're basically given 1 to 2 typical interview questions per session (1 interviewer per hour for 5 sessions plus lunch).Typically these are algorithm related and if you have a lot of experience at least one will be on architecture and design. You'll probably get at least one question dealing with combinatorics too (mine was pretty well disguised in simple math so it wasn't big deal). The first 5 minutes of each session are the interviewer introducing themselves and the project they work on and you'll usually have about 5 minutes at the end to ask questions. I got no soft questions but that might depend on the exact position and experience level. For each you have the option of using a text editor on a chromebook or a whiteboard (or both). For lunch you are assigned to another Googler they'll take you to the cafeteria and you'll eat, talk about Google and they'll probably tour you around the campus.
Overall it is extremely exhausting but goes by quick. Make sure to grab a water because you'll be talking a lot.
This feels intimidating as hell.
That would definitely work, but with the right flags, I think you may be able to just mmap the whole file and leave to the OS the hard work of paging chunks in and out.I guess it depends on the nature of the file format in question, but as a purely general solution, couldn't you create an abstraction around mmap so that you could pass an arbitrary offset into the file, and it would mmap in slices of the file as needed, un mapping earlier portions if your offset is outside the view you currently have mapped? This way you only ever have in memory a fixed amount of data, but you can access arbitrary offsets on demand.
That would definitely work, but with the right flags, I think you may be able to just mmap the whole file and leave to the OS the hard work of paging chunks in and out.
var sum = 0; var n = 25;
for (n = 25; sum <= n; sum++)
{
alert( n );
console.log;
n + sum;
}
guys i know this is amateur javascript stuff but can someone please help me solve this challenge:
// You are given one numeric variable:
var n = 25;
// Its value may change when you submit.
// DO NOT EDIT CODE ABOVE THIS LINE.
// =================================
// Your Challenge:
// 1. Declare a new variable named "sum" and initialize it to 0.
// Be sure to use the "var" keyword.
// 2. Use a for loop to add every positive integer less than n to sum.
// 3. Come up with a solution that works for all values of n.
// Your code:
PLEASE TELL ME WHAT I'M DOING WRONG! are my conditions wrong? My operators? I have a gut feeling it's my actual block of code that's off but can't figure out what exactly to write in order to come up with a solution. Thanks
Came across a late high schooler's problem that I can't solve:
Given: For some x, all y: P(x,y) AND NOT P(y,x)
Give an example of x and P for which this holds.
Can't come up with anything. Seems very difficult as if P(x,y) holds then you can just pick y to be the x for which it works, and then P(y,x) will also hold. Right?
function P(x,y){
return x == 10
}
I don't interpret it like that. It's not enough that any y satisfies, all y must satisfy but just a single x needs to. So a trivial function:
Code:function P(x,y){ return x == 10 }
x = 10, y = anything will produce true.
if we fixed the second parameter at 10, then this would produce false for every y except 10, which is not all y. Or at least that's my thought.
But this doesn't work since the second function also must be false for all y. However, it will be true for the specific case when y = 10, so P(y,x) will not be false for all y.
Edit: I think this is impossible. Consider x=y, then P(x,x) AND NOT P(x,x). That can't possible be true, can it? If so that means there is one y for which it doesn't hold, and therefore the expression is not true for all y. Maybe the question is faulty and should be "for all x and some y"?
I see. Do we know what the domain of x and y are?
Perhaps I should have defined it, but this is for a maths course with current topic predicate algebra. So I imagine programming languages can't be used (perhaps this is the wrong thread really, but programming and maths sort of intersect, especially in logic).Can you use language tricks or must the inputs be real numbers?
In JS, NaN != NaN.
(x,y) => x === x;
Perhaps I should have defined it, but this is for a maths course with current topic predicate algebra. So I imagine programming languages can't be used (perhaps this is the wrong thread really, but programming and maths sort of intersect, especially in logic).
Unless the problem is poorly worded I don't think it's possible.
For example, if you actually write this with mathematical notation you get this:
∃x ∀y P(x,y) ∧ ~P(y,x)
This is how the problem should be written if you interpret it strictly. This has been shown to be impossible earlier. For example, let y = x, then P(x,x) ∧ ~P(x,x). The set of all P that satisfy this is precisely ∅
But if you reverse the order of x and y you get this:
∀y ∃x P(x,y) ∧ ~P(y,x)
These are two entirely different statements. In the first one, you fix x and then test every y. x and y are completely independent.
In the second one, for each y the value of x can be different.
Let P(x,y) = y > x
For each y, choose x = y - 1.
P(x,y) = P(y-1, y) = y > (y-1) = true
P(y,x) = P(y, y-1) = y-1 > y = false
I am currently working through the JavaScript section on Codecademy, and I am wondering on the best way of writing a particular piece of code.
Basically I have written a rock, paper, scissors game, which works, but I also want to write an IF statement to validate the users choice. So I wrote this:
var userChoice = prompt("Do you choose rock, paper or scissors?");
if(userChoice != "rock" || "paper" || "scissors") {
alert("Please select either 'rock', 'paper' or 'scissors'");
userChoice = prompt("Do you choose rock, paper or scissors?");
}
It seems to work if I enter either rock or paper, but when I enter scissors, it doesnt like it for some reason. Also, I am wondering if there is a more elegant way of reprompting the user for their answer without duplicating the code.
I think you want to put that in a while loop so you continually prompt until they pick something correct. Also, the check should be userChoice != "rock" || userChoice != "paper" || userChoice != "scissors", without respecifying the variable you are actually saying "is userChoice rock?", then "is paper truthy?" (always), then "is scissors truthy?" (always)
Hmm, not sure what I have done now. I changed it to this:
var userChoice = prompt("Do you choose rock, paper or scissors?");
while(userChoice != "rock" || userChoice != "paper" || userChoice != "scissors") {
alert("Please select either 'rock', 'paper' or 'scissors'");
userChoice = prompt("Do you choose rock, paper or scissors?");
}
but now it doesn't accept any answers and chrome is endlessly looping through the alert and prompt.
If choice is "rock", does your condition evaluate to true or false?
"rock" also doesn't work. I am still relatively new to JS and programming in general, so I am not quite sure why this isn't working. Is it because with any choice, it also does not equal the other options i.e. whilst it may equal "rock", it does not equal "paper" or "scissors"?
Look at what happens for each comparison:
if rock:
false || true || true -> true -> loop continues
if paper:
true || false || true -> true -> loop continues
if scissors:
true || true || false -> true -> loop continues
Removes all Cards from this Deck and returns them as a new Deck. If this deck is empty, then this method returns an empty new Deck.
public class DeckImp extends java.util.ArrayList<Card> implements edu.gsu.csc1302.coll1.Deck {
///constructors and other methods
public Deck drawAll() {
Deck newdeck = new DeckImp(); //construct new deck
if (isEmpty() == false){ //check that deck is not empty
newdeck.addAll(list); //add all elements of list(what to call?) to newdeck
list.clear(); //clear old list
{
return newdeck; //return new deck, which either has the old deck's cards or is empty is isEmpty returned true
}
}
}
The code looks fine to me unless I'm missing something. What do you mean by "failing" in the pastebin? Does the program crash? Also what is "list" that you're using in the method?
guys i know this is amateur javascript stuff but can someone please help me solve this challenge:
// You are given one numeric variable:
var n = 25;
// Its value may change when you submit.
// DO NOT EDIT CODE ABOVE THIS LINE.
// =================================
// Your Challenge:
// 1. Declare a new variable named "sum" and initialize it to 0.
// Be sure to use the "var" keyword.
// 2. Use a for loop to add every positive integer less than n to sum.
// 3. Come up with a solution that works for all values of n.
// Your code:
PLEASE TELL ME WHAT I'M DOING WRONG! are my conditions wrong? My operators? I have a gut feeling it's my actual block of code that's off but can't figure out what exactly to write in order to come up with a solution. Thanks
var sum = 0;
for (n = n - 1; n > 0; n--) {
sum += n;
}
console.log(sum);
I am currently working through the JavaScript section on Codecademy, and I am wondering on the best way of writing a particular piece of code.
Basically I have written a rock, paper, scissors game, which works, but I also want to write an IF statement to validate the users choice. So I wrote this:
var userChoice = prompt("Do you choose rock, paper or scissors?");
if(userChoice != "rock" || "paper" || "scissors") {
alert("Please select either 'rock', 'paper' or 'scissors'");
userChoice = prompt("Do you choose rock, paper or scissors?");
}
It seems to work if I enter either rock or paper, but when I enter scissors, it doesnt like it for some reason. Also, I am wondering if there is a more elegant way of reprompting the user for their answer without duplicating the code.
Haha I'm here too!
Yeah, so I'm trying to learn Javascript. It's fun and all, but there are some things that I'm just like, wtf how am I supposed to know? I'm trying to learn the basics on codeacademy and then if things go well then I'm giving my hand on Eloquent Javascript.
But, one thing that is tripping me up is that they are throwing out terms willy nilly like I'm supposed to know what the exact difference between minor things are or why something has a period or a semicolon and why something else doesn't?
Like, what makes console.log("insertblahere") have a period between the console and log, but prompt("insertblahere") not have a period? Like, what exactly is "console" and what is "log," what is "prompt." I feel like I am missing an overarching hierarchy.
And then there's the semicolon. How come if/else statements have the ";" inside the curly braces, but return statements have the semicolon outside the curly braces?
I hope I'm making sense and someone can help me out. D:
Haha I'm here too!
Yeah, so I'm trying to learn Javascript. It's fun and all, but there are some things that I'm just like, wtf how am I supposed to know? I'm trying to learn the basics on codeacademy and then if things go well then I'm giving my hand on Eloquent Javascript.
But, one thing that is tripping me up is that they are throwing out terms willy nilly like I'm supposed to know what the exact difference between minor things are or why something has a period or a semicolon and why something else doesn't?
Like, what makes console.log("insertblahere") have a period between the console and log, but prompt("insertblahere") not have a period? Like, what exactly is "console" and what is "log," what is "prompt." I feel like I am missing an overarching hierarchy.
And then there's the semicolon. How come if/else statements have the ";" inside the curly braces, but return statements have the semicolon outside the curly braces?
I hope I'm making sense and someone can help me out. D:
var x = 2; //typical statement
var y = 3 //javascript will implicitly put a semicolon here
var z = 4
while(true){
//do something
} //nothing needed here because this is a block
function(x, y){
//do something
} //nothing needed here because this is a block
var func = function(x, y) {
//do something
}; //semicolon here because the function was part of an expression
return
{
value : 2
}; //this is where things get weird
//javascript is doing this:
return;
{
value: 2
}
//but what you probably want is this
return {
value :2
};
console.log("hello");
console.warn("oops");
window.console.log("hello")
window.prompt("hello");
prompt("hello")