CSE 212: Programming with Data Structures

Learning Activity: Articulating Answers to Technical Questions

Overview

In the previous weeks, you have started to get some experience responding to potential job interview questions. This learning activity will give you some additional suggestions on ways to articulate your technical answers clearly.

Interview Questions

It can feel intimidating, but most interviews that relate to software engineering will require us to answer technical questions. These questions frequently include questions related to data structures like the following:

You want to practice questions that relate the purpose, behavior, and performance of a data structure. Your responses should be concise, lasting perhaps no more than 30 seconds. Often, these questions are asked within the context of a problem to be solved. In your group practice and individual assignment this week, you will be asked to both respond to "how" you would solve the problem and then, you will actually solve the problem by writing code.

Frequently, the interviewer is more interested in your thought process of getting to the "how" instead of the actual solution. Even so, it's a valuable exercise to also solve the problems so you are better able to describe the "how" in an actual interview.

Articulating the Answer

When you approach a problem to solve with a limited amount of time to respond, you should consider the following guidance:

Notice that one of the common themes of each of these items is to "think out loud" or in other words talk about the ideas you are considering as you develop your solution. Interviewers are not impressed by candidates that have memorized a solution to a common question that may have been on the internet. This is because they are not looking for the answer to this particular problem, they are looking to see your thought process and how you approach a problem. While you are talking, they are asking themselves, "Is this the kind of person I would like to work with?"

Soft Skills Matter!

As mentioned, throughout the interview process, the interviewer is trying to decide if you are a "good fit" for their team. People generally want to work with others who are curious, kind, and hardworking. They have no interest in working with someone who is rude or arrogant, no matter how smart they are.

Often, if a person does not do well with a technical answer, they may be invited back for another interview at some point in the future. However, if an interviewer says that a person is a "bad cultural fit" for the company, they will never consider this canidate again.

This is one of the reasons BYU-Idaho and this program focus so much on learning to collaborate with others.

Activity Instructions

Consider the following scenario:

Write code to find the first time in a string when a letter is duplicated.

Answer each of the following:

  1. What are possible scenarios to consider? (For example, think of a few strings that you would want to try with your solution.)
  2. What are some data structures that may be useful? And what would their performance be?
  3. What are the boundary conditions that you should consider for this problem?
  4. Outline a possible solution.
Sample Solution (Click to Expand)

There are many approaches to a problem like this, and it should be clarified with the interviewer, but consider the following:

  1. Possible scenarios: "abcddef" "abcddeef" "abcdefde". The solution should identify "d" in all cases.
  2. Useful data structures: A Set may be helpful in this case because it does not allow duplicates. Also, it has O(1) insertion and O(1) lookup for membership. If we need to keep track of how many times a letter is repeated, a Map may be helpful. It also has O(1) insertion and lookup.
  3. Boundary conditions: "", "abc", "aaaaaaaaaa", "abB", "ab2(:~", "nñ"
  4. An approach: Create an empty Set. Iterate through the string, for each character encountered, check if it is in the set. If not, add it. If you find one in the set, that is the first duplicate. If you never find one in the set, no duplicates exist.

Submission

When you have finished all of the learning activities for the week, return to I-Learn and submit the associated quiz there.

Other Links: