Coding Challenge #11

Coding Challenge Series / Technical Interview Series

A function you create is provided as a parameter a string of arbitrary length. This string has special characteristics though — once a character is read, it is zeroed out and is then read-only.

You may access the string’s individual characters either as an array or a function (whichever your programming language supports, for example string[#] or string.getChar(#)); no other built-in string functions may be used.

The function you create must do the following:

  • Find the longest segment delimited by a character, provided as a second parameter to the function
  • The start of the string and the end of the string should be treated as if they are the delimiter character.
  • Return the longest segment as a new string.
  • Your function may not make a copy of the entire string (only if it matches the long segment).
  • If two segments are the same length, return the last one found.

Technical Interview Question/Coding Challenge #10

I’m renaming the series of interview questions to be “Coding Challenges.” Rules are still the same: you have about 30 minutes from start to finish for each question. The amount of code necessary to solve a problem is one or two whiteboards of reasonable sized handwriting (20-100 lines of code).

Technical Interview Series

Challenge #10

Create a structure best suited to efficiently storing a hierarchical file name and path system.

Now, write the code to merge two instances of the structures you have created into a single structure. There should be no duplicate file names in the single structure.

Technical Interview Series

I’ve created nine technical interview questions so far as part of my ongoing series.

Just as a reminder, each question should be solvable in less than 30 minutes time (sometimes less). Some amount of coding is typically necessary to solve the problem (either actual code or pseudo-code), but occasionally, just a plan or discussion-style response is expected (although to date, they’ve all been coding questions).

Hope you’ve enjoyed the series so far. If you have any suggestions, send them my way!

Question #1

Question #2

Question #3

Question #4

Question #5

Question #6

Question #7

Question #8

Question #9