Laserfiche Interview Question

Note: They have you code with a wireless mouse and keyboard, connected to a large projector. You end up coding in Netbeans, writing the code all proper. They had a folder of about 4 different tech questions they were going to ask. One of them was a roman numeral one, and the one I got was parsing a string "1, 2, 4-7, 9" into a PageRange class (which is provided to you). You're implementing the constructor for it.

Interview Answer

Anonymous

Apr 14, 2014

You want to find a way store all the valid page numbers. Basically, in the above example of "1, 2, 4-7, 9" all valid pages would be 1, 2 ,4, 5, 6, 7, 9. Perhaps storing all the valid numbers into a global ArrayList. In order to find the correct values (in java) you'll want to split(",") split on the commas, and then ParseStringToInt or something, and place it into the global array. Also for ranges "4-7" you'll split on the split( "-" ) instead. There's some checks you'll have to throw in there to make sure you're parsing into an int, and not a string with a " - ". After that you also have to handle cases such as string like "abcd, 1, 3-7" And also a function that checks to see if a given interger is within the page ranges. e.g. ( is 5 within the valid page ranges? Check the global arraylist and return) Also the answer to the brain teaser I had about car manufacturing was that the wash tanks needed to be switched out for a fixed number of cars. Detestably ambiguous though. I also heard they like brain teasers. If I'd finished that program I'm willing to bet they would've asked me one.

1