We need to setup our dev environment (quickly) with a few bash commands:
mkdir cassini
cd cassini
mkdir csvs
touch csvs/import.sql
touch README.md
createdb cassiniWe need to setup our dev environment (quickly) with a few bash commands:
mkdir cassini
cd cassini
mkdir csvs
touch csvs/import.sql
touch README.md
createdb cassiniThere are numerous ways to get a PostgreSQL server up and running - the easiest is usually your best choice!
I like to run Postgres locally, so I typically run Postgres.app because I'm working on a Mac. It's very flexible and is a drag/drop install.
You can also work with Docker if you like, but beware that you might run low on resources later in the course as we dive into millllllions of records. Here's a docker-compose file for you to get started with:
version: "3"
services:
postgres:This question is seemingly simple:
Decide if a tree is a binary tree
and then…
Decide if the tree is balanced
Another super common question you will likely be asked in one form or another. Interviewers just LOVE questions about binary tree traversal!
We're going to start Jon off with a bit of a softball, asking him to create a linter for C#. Here’s the question:
Create a linter for C# which ensures that code structures are balanced. Specifically, code blocks starting with (, { and [.
Normally this question would take a candidate about 30 minutes, even if they haven't studied their interview questions.
Code is just a string and we're checking to make sure that certain characters have their counterparts. How would you solve this? Think about it for a minute and see if your ideas match Jon's.
We'll be using C# for this and the rest of the questions.
This one is a bit tougher so don't feel bad if you don't finish. Again: the point is to demonstrate your thinking process and that you ask enough questions and think things through before you write any code.
Here’s the question:
You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists.
Here's some sample code
// For example,Here's another practice question from Interview Cake, who kindly allowed me to use this other questions in this production.
Once again - I encourage you to do your best before watching all of the video. We can then try to solve it together!
Here’s the question:
Write a function getProductsOfAllIntsExceptAtIndex() that takes an array of integers and returns an array of the products.
Starter code:
OK grab your journal and dive in with me! I'll be solving this question by hand I urge you to do the same. I'll show you the solution near the end - but give it your best shot!
This question is from InterviewCake - thanks to Parker Phinney for permission to use. You can solve it there right now, if you like, as it’s part of the free questions.
Here’s the question:
Write an efficient function that takes stockPricesYesterday and returns the best profit I could have made from 1 purchase and 1 sale of 1 Apple stock yesterday.
Starter code:
I know you're wanting to jump right in and practice, but do yourself a favor and take a minute to get your head in the right place. So many people get super frustrated with this process and decide it's all a bunch of crap - and then they give up and either fail the interview or cancel before they get there.
Seriously - I can't tell you how many times I've heard a friend tell me how stupid Company X is becaust they wanted them to write a basic algorithm on the white board. The sentiment is always the same:
What does writing a search algorithm have to do with my job? NOTHING. Why are they even asking me this crap!
They're asking you these questions because, believe it or not, people like to lie on their resume. They don't know you and they especially don't know what you know. They want to be sure you can do the things you say you can do on your resume, so they're going to ask you to solve some problems.
So, deep breath. Let's do this - these are very good jobs and these companies want to pay you a
| /******************************************************************************* | |
| Chinook Database - Version 1.4 | |
| Script: Chinook_PostgreSql.sql | |
| Description: Creates and populates the Chinook database. | |
| DB Server: PostgreSql | |
| Author: Luis Rocha | |
| License: http://www.codeplex.com/ChinookDatabase/license | |
| Modified By: John Atten |
| FROM postgres:14-alpine | |
| COPY ff.sql /docker-entrypoint-initdb.d/seed.sql | |
| ENV POSTGRES_USER=docker POSTGRES_PASSWORD=docker POSTGRES_DB=ff | |
| EXPOSE 5432 |