Sharing 2 Interview Questions I was asked the other day for entry software engineer.

  • 0

    A customer wants specific shelf sizes for a building. The company does not send the customer specific sizes but instead sends the customer bulk shelves the customer can cut them selves. Each bulk shelf size is 60 inches. Write a function that accepts a list, and returns how many shelves they need.

    public void int getShelves(List<Integer> shelfList){


    They did not care whether I provided an optimal solution using dynamic programming, or a simple solution that was right most of the time, but always provided at LEAST enough bulk shelves for the customer.

    Brain Teaser I was asked.

    There are a "x" number of cats that weight 5 lbs and a "y" number of dogs that weigh 10 lbs. The boat can only hold 10lbs at a time, They need to cross the river, write a function that returns how many trips it will take. cats >=2

    trips = (x,y)

  • 0

    Brain Teaser is super easy, given that the boat holds exactly 1 dog. Answer is y + x / 2. +1 trip if there's an odd # of cats.

  • 0

    If i remember correct, the answer I got was y+(2x-3) for the brain teaser. Took me like a half hour though...Was up there shaking and freaking out, first technical interview. Was interview by a board of 6 people watching me work through these problems.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.