Cracking Hudson's Software Engineer Interview: Easy String & Array Questions

hudson | Software Engineer | Interview Experience

Interview Date: Not specified
Result: Not specified
Difficulty: Not specified

Interview Process

The interview lasted 70 minutes and consisted of four questions that were relatively simple.

Technical Questions

  1. Strings
    You are developing an automatic moderation system for a chat application that detects certain linguistic patterns. Given a string chatMessage containing a sequence of characters, your task is to count the number of substrings of exactly length 3 where at least one character is a vowel (“a”, “e”, “i”, “o”, “u”, or their uppercase counterparts). Return this number as an integer.

    • Example: For chatMessage = "codeSignal", the output should be solution(chatMessage) = 8.
    • Explanation: The substrings of length 3 are: “cod”, “ode”, “des”, “esi”, “sig”, “ign”, “gna”, “nal”. All these substrings contain at least one vowel. Thus, the answer is 8.
  2. Arrays
    You are helping a bird build its nest. You are given an array forest, containing positive integers and zeros, and a non-negative integer bird, representing the bird’s initial position. Each positive integer within the forest is considered to be a stick, where the value represents the length of the stick. Each zero within forest represents that this place is empty.

    • The bird builds its nest by flying to the right until it finds a stick, then returning to its initial position and attaching the found stick to the nest. It then flies in the opposite direction and repeats the process until the total length of the sticks in the nest reaches 100.
    • Example: For forest = [25, 0, 50, 0, 0, 0, 0, 15, 0, 0, 45] and bird = 4, the output should be solution(forest, bird) = [7, 2, 10].

Tips & Insights

Focus on understanding the problem requirements and constraints clearly before jumping into coding.