Addepar OA (Frontend + Backend)

They automatically give everyone OA. I applied for both frontend and backend and received OA for both within 3 days.

I will go over the questions for both positions.

Spoiler Alert: I bombed it.


FrontEnd

I took frontend first. There is a coding question and 3 multiple choice question. And you are given 45 minutes to solve it.

Coding Question

Given an array A of length N. For each A[i], you have to find the height of a stair that you can make.
For example, for A[i] = 7, you can make

  *
 **
***

Height is 3, so print 3 to console.

Constraint

  • 1 <= N <= 1e5
  • 1 <= A[i] <= 1e15
My Solution

We know that NEED = 1 + 2 + ... + M = M * (M + 1) / 2. For each A[i], binary search for the largest M such that NEED <= A[i], and print it out. This will run in about O(27N).


Multiple Choice 1

Given 2 string in HTML5 in <p> XXXX <\p> in separate 2 lines. Choose the CSS that will make both strings appear in the same line.
I don't remember the specifics, but you are given float, align, inline, etc options to choose from. You can only choose 1 option.

My Solution

Grab another device and use an online HTML/CSS compiler and enter all 4 options and choose the one that works.


Multiple Choice 2

Given a picture of a block of text that appears in esplise shape on the left and straight verticle line on the right.
What is the CSS for this? You are given a combination of shape-outside/shape-inside/float/align to choose from. You can only choose 1 option.

My Solution

Grab another device and use an online HTML/CSS compiler and enter all 4 options and choose the one that works.


Multiple Choice 3

Given some HTML codes that displays "hello" to the screen, and select all options in javascript that appends "bob" to it such that screen now shows "hellobob".

My Solution

Grab another device and use an online HTML/CSS compiler and enter all 4 options and choose the 2 that works.


Backend

That was the end of frontend questions.
For backend, things are a bit different. There is only 1 coding question to solve for 45 minutes.

Coding Question

Given an array of items of length N, where each item contains [name, relevance, price]. Also given sortParamenter, sortOrder, pageNumber, itemsPerPage. You have to sort it.

  • sortParameter: It can be either 0, 1, 2. denoting which column that the sort is based upon. 0 -> name, 1 -> relevance, 2 -> price.
  • sortOrder: It can be either 0, 1. 0 -> in ascending order, 1 -> in descending order.
  • pageNumber: This page stores all the items that we are supposed to get. It starts from 0.
  • itemsPerPage: how many items are on a page.

Find all the items on the specified pageNumber and return a list that contains all the names in sorted order. In case of a tie, sort it so that it still respects its relative position.

Constraint

  • 1 <= N <= 1e5
  • 1 <= relevance <= 1e8
  • 1 <= price <= 1e8
  • 0 <= pageNumber < 10
  • 1 <= itemsPerPage <= 20

My Solution

I coded up a WA solution based on quickselect O(N) because I saw that we only care about the top 200 elements.

  • code up a comparator based on the rules
  • quick select across the whole array to select the top 200
  • sort the top 200 items or whole item vector, whichever is smaller.
  • put the names in [pageNumber * itemsPerPage, pageNumber * itemsPerPage + itemsPerPage) into the answer vector.
  • return it.

This gets WA because I missed a very important detail. did not locate the bug in time, so I didn't submit it. This is the first time I was not able to solve a LeetCode-style OA question :/

Comments (4)